in reply to (dchetlin: Benchmark fixes) 30 Spaces- 1 question
in thread 30 Spaces- 1 question
*sigh* That will teach me, eh? I should have run it with it not printing to STDERR and that piped to /dev/null =)
Also, in my defense, it was after my bedtime =) Don't apologize for being sharp...
What is worse it that I tested a working version of the for_index_substr but "cleaned it up" for the final run.
I normally use vars ... to avoid the scope issue. =( *woe is me*
OTOH, I don't get your numbers when running your code. Number one, your results check should be:
foreach (@result) { print "bad!" unless ($_->{REx} eq $_->{split} and $_->{split} eq $_->{index}); }
Those arrows are important. Second, the comparison will always fail because your regex includes the terminal space and the split version doesn't. Also, if there were multiple spaces or other types of whitespace they would fail but we both agreed to ignore that. =)
Third, I still get equivalent results, (split_join_2 has the non-magical /\s+/ regex, just for fun. I get this with cmpthese 20,000. (using cmpthese -10 gives the equivalent results.)
Rate split_join_2 split_join regexp for_index_substr split_join_2 3205/s -- -0% -4% -6% split_join 3205/s 0% -- -4% -6% regexp 3344/s 4% 4% -- -2% for_index_substr 3413/s 6% 6% 2% --
Worse, the array slice hack on the end of (split...)[0..29] throws warnings on -w if there are too few items in the slice to join. Join doesn't like undef it appears =)
All in all, I'm now less enlightened now. Did I cut-n-paste wrong? I print debugged to verify that bits were working all thru it. *sigh*
--
$you = new YOU;
honk() if $you->love(perl)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: (dchetlin: Benchmark fixes) 30 Spaces- 1 question
by dchetlin (Friar) on Oct 10, 2000 at 08:34 UTC | |
by extremely (Priest) on Oct 10, 2000 at 08:39 UTC |