title: Solidity: looping within contract or just calling for all values?
body: <p>I have a Solidity smart contract to run on the Ethereum network, that has a public mapping which stores a struct with several attributes. I must loop through all of those stored structs looking for a specific attribute value that may or may not be unique, (i.e. <em>users['Joe'].age == &quot;30&quot;</em>). Those might add to over 1000 structs, each having about 6 attributes.</p>
  <p>What should I do, in terms of cost versus performance? Run an internal loop inside the contract and get only the results I want, or make a loop to call all of the structs individually, then run a loop outside of the blockchain to find them?</p>
  <p>I'm kind of lost, here. Thank you.</p>