News for hackers. Stuff that matters.
Re:Faster than C? Parsing binary data in JavaScript. by SoftwareMaven on Sunday October 07, 2012 @06:56PM (#4624718)
You are wrong. A JITted environment can take advantage of knowing about the current run of the system. As a result, it can do things like unroll loops and inline function calls.

Yes, you could do the same thing in C code, but the resulting executable would be unreasonably large because you would have to unroll every loop and inline every function.

Pypy has show itself faster than C in some cases as well[1].

1. http://morepypy.blogspot.com/2011/08/pypy-is-faster-than-c-a...

Re:Faster than C? Parsing binary data in JavaScript. by tptacek on Sunday October 07, 2012 @07:08PM (#4624748)
That PyPy example has nothing to do with C and everything to do with a particular implementation of libc.
Re:Faster than C? Parsing binary data in JavaScript. by tedunangst on Sunday October 07, 2012 @07:06PM (#4624740)
Maybe some day they will add profile guided optimization to C compilers.
Re:Faster than C? Parsing binary data in JavaScript. by thedigitalengel on Monday October 08, 2012 @11:02AM (#4627128)
They're not the same. VMs can assume invariants (which may not always hold) and compile specialized methods which depend on those assumptions and then fall back to a non-optimized version during the execution of a method. To do something like that (OSR) in C, you'll have to have a very sophisticated runtime.
Re:Faster than C? Parsing binary data in JavaScript. by taf2 on Sunday October 07, 2012 @08:18PM (#4624929)
you're kidding right? and at least referring to gcc's -fprofile-generate -fprofile-use right?
Re:Faster than C? Parsing binary data in JavaScript. by tptacek on Sunday October 07, 2012 @08:46PM (#4625006)
Profile-guided optimization is decades old. It was, for example, one of the things people loved about the (Ultrix?) DEC Alpha compiler was profile-driven optimization.
Re:Faster than C? Parsing binary data in JavaScript. by wglb on Monday October 08, 2012 @08:56AM (#4626599)
First VMS.

That was one of the outstanding compilers ever written.

Re:Faster than C? Parsing binary data in JavaScript. by pbiggar on Monday October 08, 2012 @03:09AM (#4625829)
There is a major difference between performing profile-generated optimizations at compile-time based on sample data, and performing it at run-time based on real data. It is one pretty good way in which JITs could beat programs implemented directly in C.
Re:Faster than C? Parsing binary data in JavaScript. by gillianseed on Monday October 08, 2012 @07:51AM (#4626410)
Not really since the 'sample' data is 'real' data which has been gathered during run-time.
Re:Faster than C? Parsing binary data in JavaScript. by pbiggar on Monday October 08, 2012 @09:43PM (#4629540)
That is the most optimistic statement about profile-directed optimization that I have ever read.