I want to use a function to find all tokens of a user in solidity, so I use a for loop to iterate over all tokens and look if the addresses do match. But my function always returns zero for 10Mio iterations, so I implemented a test function to see where the limits are. Does solidity have a problem with huge for loops? For example I tried the following test function, which returns always 0 if the number of iteration is above around 3'000'000. It looks like there is a timeout for a function to run?
function testLoop(uint256 num) external view returns(uint256 res) {
uint256 i=0;
uint256 cnt=0;
for(i;i<num;i++) {
cnt++;
}
return cnt;
}