NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Eh? (Score:2)
For my results, I used ruby 1.6.7 and perl 5.8.0 on Mandrake 9. I took the sample text you gave in your journal entry and copied it over and over until I ended up with a 2.4 MB file. I used "bzip-0.21" as the target. Hopefully, I didn't screw up the logic.
I've provided the exact b
Re:Eh? (Score:2)
Ruby:
Perl:
Re:Eh? (Score:1)
Anyway, I actually was able to get the benchmark on the Perl test significantly lower by doing 2 things:
I precompiled the regexp
I joined the relevant search fields using an (assumedly) unused char (^A) and searched on that.
On my box that put the average from around 37 secs. to around 26 secs. (Using djberg96's benchmark version of the script).
use Benchmark;
use strict;
my
Re:Eh? (Score:1)
Thanks.
Buck
Re:Eh? (Score:1)
Or use List::Util::first instead of grep (though it may only be an improvement on bigger arrays).
I'm using perl 5.6.1 and ruby 1.6.8 and getting ruby about twice as slow as perl.
Re:Eh? (Score:2)
Re:Eh? (Score:1)
I just installed Ruby today, and have been poking through online docs earlier, and couldn't find a 'break' or 'last' statement. Is there such a thing? The best I could come up with was throwing an exception and catching it outside that loop. I still need to g
Re:Eh? (Score:2)
Visit rubycentral [rubycentral.com] or ruby-doc [ruby-doc.org].
The first link is an online version of Programming Ruby, aka "The Pickaxe". You can still buy that book at the store, if you prefer paper.
Re:Eh? (Score:1)
I was poking through the bookstore and the only Ruby book there was Sam's "Learn Ruby in 21 days". I can't recommend it, as it had no mention of 'break', 'next', or 'redo', nor the IO.foreach method in your example (and it was a thick book).
Re:Eh? (Score:1)
[ayeka:~/portfinder] buck> repeat 5 time ruby pftest2.rb ruby
68.394u 2.119s 1:10.56 99.9% 4+1346k 0+0io 0pf+0w
69.770u 2.258s 1:12.08 99.9% 4+1346k 0+0
Buck
Re:Eh? (Score:2)
127.33user 2.35system 2:10.31elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (222major+301minor)pagefaults 0swaps
Perl:
126.28user 1.74system 2:08.32elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (374major+164minor)pagefaults 0swaps
Perhaps it's a NetBSD issue? Seems unlikely, but based on the results you're getting versus what I'm getting, I'd consider it a possibility at least. At least I cut it down to x2 instead of x4!
Please consider posting to the mail
Re:Eh? (Score:1)
Perhaps it's a NetBSD issue? (Buck: FreeBSD even :) ) Seems unlikely, but based on the results you're getting versus what I'm getting, I'd consider it a possibility at least. At least I cut it down to x2 instead of x4!
Agreed.
Please consider posting to the mailing list with this info (ruby-talk@ruby-lang.org).
I'd like to try these on my TiBook with OSX 10.2.3 first, though I don't expect much of a change. Is the mailing list archived somewhere where I can research before posting anything?
By the way,
Buck
Re:Eh? (Score:2)
There's a gateway between the mailing list and comp.lang.ruby, so you can search via deja (or your local news serve) and get everything from the mailing list that way.
FreeBSD even :) - Oops. Probably not the first time I made that mistake. Probably won't be the last. :-P