| Next | Making Programs Faster | 11 |
The world is full of dumbassed 'optimizations' and 'benchmarks'
We'll see several today
Here's one I found while researching the Schwartzian Transform
The goal here is to do a case-insensitive sort
sort { lc $a cmp lc $b } @stuff;
Here's what was suggested:
Date: Sat, 15 Mar 1997 00:55:47 GMT
Subject: Re: Sorting help
Message-Id: <3329eefd.140372364@news.oz.net>
# The *drum roll* Schwartzian Transform!
@sorted = map {$_->[0]}
sort {$a->[1] cmp $b->[1]}
map {[$_, lc $_]}
@stuff;
Boldface code is operations that were added
| Next | ![]() |
Copyright © 2003 M. J. Dominus |