LWN.net Logo

Still waiting for swap prefetch

Still waiting for swap prefetch

Posted Jul 25, 2007 23:50 UTC (Wed) by kune (guest, #172)
In reply to: Still waiting for swap prefetch by elanthis
Parent article: Still waiting for swap prefetch

If Firefox is really faster on Windows than on Linux, then it should be easy to hack some benchmarks in Javascript to prove it. Nobody will be able to fix it, if he cannot measure the performance. And Internet network bandwidth has be taken out of the equation.

Sure, you can write bad code in any language, but in my experience Python is not particularly slower than other script languages. Here is a benchmark that appears to validate that experience: http://www.timestretch.com/FractalBenchmark.html Another one is here: http://acker3.ath.cx/wordpress/archives/7

Lua might be something to look at.

Of course you will always be able to write faster code in C, but this will take you some more time.


(Log in to post comments)

Still waiting for swap prefetch

Posted Jul 25, 2007 23:53 UTC (Wed) by JoeBuck (subscriber, #2330) [Link]

Besides, for a GUI program "written in Python" all the expensive code is actually in libraries that are written in C or C++, with a thin binding to allow calls from Python. yum isn't slow because of Python, but because it does way too many system calls and I/O.

Still waiting for swap prefetch

Posted Jul 26, 2007 0:09 UTC (Thu) by briangmaddox (subscriber, #39279) [Link]

"Of course you will always be able to write faster code in C, but this will take you some more time."

Ya had me until you said this. Why stop at C, when it could be written in ASM? And heck, how do you know the assembler will generate fast code, better do it in hex instead.

I would have thought that after all these years that people would learn more about computer science and programming than to troll the "C is always faster than everything else" line.

Still waiting for swap prefetch

Posted Jul 26, 2007 5:15 UTC (Thu) by wilreichert (subscriber, #17680) [Link]

"Ya had me until you said this. Why stop at C, when it could be written in ASM? And heck, how do you know the assembler will generate fast code, better do it in hex instead."

Hex? No thanks, i prefer to hack the macro assembler and control the logic gates on my cpu directly.

Still waiting for swap prefetch

Posted Jul 26, 2007 9:46 UTC (Thu) by nix (subscriber, #2304) [Link]

The thing to do is to generate the assembler and then munge it with a horrible perl script.

(Hey, ghc does it, it must be good! :) )

Still waiting for swap prefetch

Posted Jul 26, 2007 12:04 UTC (Thu) by dcoutts (guest, #5387) [Link]

Shh! You're not supposed to tell people about that, it's called the Evil Mangler for a good reason.

Still waiting for swap prefetch

Posted Jul 26, 2007 13:51 UTC (Thu) by nix (subscriber, #2304) [Link]

Having just watched it use fifteen minutes of CPU time (on the ghc lexer, natch) I think it needs bringing into the light so it can be optimized by some hardier soul than I :)

program speed vs programming language

Posted Jul 27, 2007 23:06 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

Why stop at C, when it could be written in ASM?

That's not a natural progression. Code compiled from C is often faster than that compiled from assembly language, for the same reason that a computer can land an airplane more smoothly than a human. Even code compiled from C by a naive compiler (e.g. gcc -O0) is unlikely to be slower than code compiled from assembly language. C is that low-level a language.

how do you know the assembler will generate fast code, better do it in hex instead

We do know that. The assembler will generate code that is not only the same speed as that generated by the hex editor, but is actually the same code. That's the definition of assembly language.

I would have thought that after all these years that people would learn more about computer science and programming than to troll the "C is always faster than everything else" line.

The only line I saw was, "C is always faster than Python." And it is, isn't it?

program speed vs programming language

Posted Jul 31, 2007 12:08 UTC (Tue) by liljencrantz (subscriber, #28458) [Link]

Depends on how you define your scope. I've seen situations where people solve the same problem in different languages, and because they have to spend so much time to do _anything_ in a low-level language, they are forced to chose a dumb algorithm, whereas people coding in a high level language can spend more time on the high level logic and can therefore chose a fast algorithm.

Still waiting for swap prefetch

Posted Jul 26, 2007 9:44 UTC (Thu) by nix (subscriber, #2304) [Link]

Benchmarks in Javascript will mostly show the performance of the JS interpreter and things it can block on, i.e. it's not a complete monitoring tool by any means.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds