News for hackers. Stuff that matters.
Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by viraptor on Tuesday January 19, 2016 @04:47PM (#10934324)
Is that really the case for unittests? (this will be different for actual run in production) Apart from some things shared across the whole codebase (loggers, db access, etc) most of the code is unlikely to ever get "hot" enough for the optimised JIT to kick in.
Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by mike_hearn on Tuesday January 19, 2016 @05:04PM (#10934454)
You'd think so, but in reality if you take something like a big Java codebase and disable the compilers, then run the unit tests, they are always waaaaaay slower.

The "shared across the whole codebase" stuff tends to be much bigger than you'd think. For instance the collections libraries, string manipulation, any core code or data structures in your own codebase, etc, all get compiled very fast. You don't have to run something very often for it to become eligible for compilation.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by viraptor on Tuesday January 19, 2016 @05:11PM (#10934502)
While that's true about the usage I'm not sure it applies in that comparison. All primitive collections, string manipulation, simple ops, etc. are already written in non-interpreted language and compiled AOT in Python. I expect they're also native in V8 and Ruby, although I don't know that codebase.

I'm not sure about "core code". I mean, the context is "unit tests", not "functional tests". If you have hot core code in your unit tests, then something smells... Hot helpers, and cross-cutting utilities, sure, and I mentioned them.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by pcwalton on Tuesday January 19, 2016 @04:53PM (#10934375)
If the code isn't hot enough to leave the interpreter into tier 1, then the engine has judged that interpretation is likely to be faster than non-optimized compilation plus machine code execution. An AOT compiler with no interpreter (such as Go) only has the latter option. So, assuming the JIT is tuned properly, the resulting turnaround time will be faster than AOT.
Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by viraptor on Tuesday January 19, 2016 @05:00PM (#10934427)
But your comment wasn't about Go, it was about "slow dynamic" (python, ruby) vs V8. I'm saying that's just "non-optimized" vs "very likely non-optimized", so multi-tier JIT shouldn't affect much of the unittest runs.

Even following that logic about JIT vs AOT in a single run, the python vs v8 equivalent would be that: you have non-optimized code vs non-optimized code which still has to keep track of execution counters, therefore the one without counters should be faster.

Regarding unittesting Go vs V8... I'd really like to see a big project where it could be compared - unfortunately that's not realistic.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by pcwalton on Tuesday January 19, 2016 @05:14PM (#10934531)
Oh, I see. Apologies for misinterpreting you.

In the case of, say, CPython vs. V8, it may well be a tossup. But I highly suspect that V8 would usually win even for unit tests because it'd be able to optimize functions that many unit tests share. For example, it could optimize the test harness itself (important when it's a nontrivial test harness like Cucumber or whatever), it could optimize the string search/regex functions, and so on.