I defined an array of objects in the Ethereum smart contract. An object is a structure that is inserted into the array every time a function is called.When 80,000 data is inserted, it takes a long time, estimated at 25 hours...When traversing the array filter, directly reported timeout.The geth client used
I find it very unnecessary to use an array and traverse over it.If you really want to do something like this, just don't use loop
Question 1: Why don't use loops?
Answer: Because Transaction fee will increase with each loop and will cost use alot of money. Plus it's the slowest method for searching method
Question 2: Then what is other option to do code this function?
Answer: Store each id in mapping(address=>uint256). It will cost you alot less and it'll be far more efficient also.