in reply to Re: (Guildenstern) Re: Re: Taming a memory hog
in thread Taming a memory hog

So, I tried to make my record creation more efficient. Currently, there's three levels of nested foreach, plus some extra logic for special locations in the record. I realized that all of this could be rewritten using a single foreach containing a map. Chopped the lines of code by over half to create each record for output to the file.

Then I ran it. As guessed above, 6 minutes is a normal run for 100,000 records. With my nifty new changes, creating 100,000 records takes almost a full minute longer. I don't know if using a map within a foreach is a good idea, but something sure seems to slow it down.

On a side note, creating every piece of data in a record includes a call to rand, which is probably a large factor in why generating records takes so long.


Guildenstern
Negated character class uber alles!