Perl: the Markov chain saw | |
PerlMonks |
Re^2: Inconsistent Results with Benchmarkby benwills (Sexton) |
on Dec 08, 2014 at 06:40 UTC ( [id://1109517]=note: print w/replies, xml ) | Need Help?? |
That makes sense. I was loading about 500kb of text into a variable, then running the regular expressions on that. I just tested it (without your suggestion) with a file of about 2mb and saw a similar trend. Then tested with a smaller file and saw less of the trend. Then I used your idea, with some slight changes, sub a_(){ my @a; $a $_ = 0 for 1 .. (4 * 1024); }, and tested with a few different file sizes. I'm not entirely sure if the changes I made would make that sub not function as you intended. I'm a mediocre programmer and new to Perl, so I don't fully understand how q and square brackets work in your code, even after just looking up some documentation. (I'm sure it'll sink in in a couple of days). After I added that sub, I began consistently getting the same results with a 5 second timer as I do with a 60 second timer. Thanks for that. It was a bit discouraging earlier to find out that a few days worth of testing was mostly nullified. But understanding a little more about what's going on and figuring out how to compensate for it definitely helps. If you think it would be valuable for any reason to put my code up here, I can clean it up and get it up here. Otherwise, I think I'm good. (minor edits for clarification)
In Section
Seekers of Perl Wisdom
|
|