in reply to Re: Inconsistent Results with Benchmark
in thread Inconsistent Results with Benchmark
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inconsistent Results with Benchmark
by BrowserUk (Patriarch) on Dec 08, 2014 at 07:05 UTC | |
by benwills (Sexton) on Dec 08, 2014 at 07:12 UTC | |
|
Re^3: Inconsistent Results with Benchmark
by ysth (Canon) on Dec 08, 2014 at 07:52 UTC | |
by flexvault (Monsignor) on Dec 08, 2014 at 15:31 UTC | |
by benwills (Sexton) on Dec 08, 2014 at 23:44 UTC | |
by flexvault (Monsignor) on Dec 09, 2014 at 18:52 UTC | |
by benwills (Sexton) on Dec 09, 2014 at 21:14 UTC | |
by benwills (Sexton) on Dec 08, 2014 at 23:40 UTC |