Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: fast, flexible, stable sort (works?)

by tye (Cardinal)
on Mar 08, 2004 at 21:08 UTC ( #334929=note: print w/ replies, xml ) Need Help??


in reply to Re: fast, flexible, stable sort
in thread fast, flexible, stable sort

It doesn't work.

Really?

Well, it does work,

Oh...

but only if the XFORM routine returns a string of the same length for every item.

"only"? (:

Actually, it always works if the fields are fixed-length. It also always works if the fields don't contain "\0" characters and you don't have more than 16 million records. Those two cases cover almost every sort I do.

It often works when these guarentees don't apply.

It is also fairly easy to fix it so it always works even if you have fields with lots of trailing null bytes. For example, a s#([\00\01])#\01$1#g and join "\0", is enough.

I noticed the potential for this problem quite a while ago and hoped to address it in the module based on this idea, but working on such a module hasn't made it to the top of my list yet. Thanks for motivating me to address the problem here. :)

- tye        


Comment on Re^2: fast, flexible, stable sort (works?)
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://334929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2014-09-20 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (152 votes), past polls