Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
more useful options
 
PerlMonks  

Re: Remain calm and confident in difficult times

by tilly (Archbishop)
on Nov 11, 2005 at 02:18 UTC ( [id://507653]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Remain calm and confident in difficult times

If you believe that I/O performance was the difference between Perl and Java on that test, then you believe that Perl's I/O system is so bad that it takes minutes to run through 100 MB of local data on a decent PC.

No sane person with even a modicum of knowledge about the relative costs of different computing operations would think of that first. They wouldn't have to test it to know that I/O was highly unlikely to be the cause of that much slowdown.

But you seem to think it worth testing, so I did a quick test on my laptop. Just running through and doing something trivial (counting lines) on a 5 MB file took me .266 seconds the firs time and 0.072 seconds on subsequent runs. Therefore the worst case just to run through 100 MB on my laptop would take under 6 seconds, and the vast majority of that worst case is spent with the operating system waiting for disk. (The difference between the first and later runs is that the file gets cached in RAM, so on later runs it doesn't go to disk.)

Should you wish to repeat my test on your machine, here is the program:

time perl -le '$l++ while <>; END {print $l}' BIG_FILE
In short, as I predicted, file I/O for that much data is a couple of orders of magnitude too small to explain the performance difference in Tim Bray's test.

As for your taking me to task for expecting Java to have not optimized this case, try compiling and running the following Java program:

import java.util.regex.*; public class FooTest { public static void main(String[] args) throws Exception { Pattern p = Pattern.compile("^(\\s*foo\\s*)*$"); Matcher m = p.matcher("foo foo foo foo foo foo foo foo foo foo foo + foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo +foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo f +oo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo fo +o foo foo foo foo foo foo foo fo"); if (m.find()) System.out.println("Matched"); else System.out.println("Didn't match"); } }
If that program hangs, then your version of Java does not implement the optimization that I said caused a significant slowdown in Perl. By my tests, Java does not implement that optimization, but perhaps you have a version that does. (I would bet money that you don't.)

So while you disparage the reasoning by which I concluded that Java was very unlikely to have that optimization, I seem to have come to the correct conclusion about whether or not it did. If you wish, you may believe that I just made a lucky guess.

Incidentally for future reference, if you're planning to criticize articles, it helps to provide links to them so that people can see what you're talking about. The article of mine that you were criticizing was Benchmarks aren't everything. I suspect that the other article was Enterprise Perl, but it might have been What is Enterprise Software? instead - I can't tell from what you've said.

Replies are listed 'Best First'.
Re^2: Remain calm and confident in difficult times
by Anonymous Monk on Nov 11, 2005 at 02:30 UTC

    I am glad that I educated you how to do some serious work.

      In the words of Popeye, "I've taken alls I can stands, I can't stands n'more!". If I had to pick someone who knew how to do "serious work", I'd say that tilly qualifies. You didn't teach him anything. If you're speaking to the fact that he initially ignored I/O in his arguement, it's not that it was ignored, but generally assumed to be a non-factor for the reasons stated above. Where else, pray tell, did he fail to do "serious work"?

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

        Trolls are like zits. Keep picking at them and they'll never go away :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://507653]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.