9 ms·
Out of a class of about 15 students, only one person beat me (and only barely), and he wrote significant portions of his program directly in Assembly Language.
by stcredzero 16y ago
Out of a class of about 15 students, only one
person beat me (and only barely), and he wrote significant portions of
his program directly in Assembly Language. The next fastest after me
took nearly twice as long to do the same work.
...A runtime profile of my program revealed
that the majority of time was spent in the C routines "malloc" and
"free."
For all of the beginning programmers and most of the student programmers out there: Yes often a fast JIT VM might actually beat your C or get pretty close! If you ever become a good programmer, then you can do much better than the JIT in key situations.
EDIT: There's a self evaluation method here for aspiring C programmers. Start benchmarking your code against the same thing in LuaJIT. You're not "good" until you know how to routinely beat it by a factor approaching 2. And that's necessary, but not sufficient.
- scscsc 16y agoHe does not use a JIT, he translated his code into C by hand.
- stcredzero 16y agoI never said he did. I think it's good to point out there's a lot of beginner C code out there involving significant memory management that's not much better or slower than the best JITs. EDIT: Added "involving memory management" EDIT: To students doing C programming: Be honest, now, but have you ever checked?