Perl-Sensitive Sunglasses | |
PerlMonks |
RE: Schwartzian Transform vs. plain Perlby mikfire (Deacon) |
on Jun 08, 2000 at 16:38 UTC ( [id://17064]=note: print w/replies, xml ) | Need Help?? |
The savings generated by the Transform ( too early in the
morning to type Schwartzian - sorry merlyn ) is the
expensive_func part ( cref)
In the archtypical case, that expensive function is hitting
the disk for file sizes.
In your benchmarks, there is no "expensive_func". Yes, the hash lookup is a bit more expensive than the array lookup, but not that expensive. The expense of the extra map() is greater than the savings realized by doing the array lookup. To reap the benefits of the Transform, do something real - like stat some rapidly changing file on your filesystem
HTH,
In Section
Seekers of Perl Wisdom
|
|