News for hackers. Stuff that matters.
Re:What I Learned Making My Own JIT Language by gameswithgo on Wednesday June 27, 2018 @02:33PM (#17410619)
a JIT is one! time is wasted doing compiling while running, the compiler has strict time constraints so can't do as many optimizations, claims about theoretical benefits from runtime data collection and-recompilation for optimization are rarely reazlied in the actual world and profile guided optimizations can achieve similar things for AOT compiled programs. soooooooooooo

AOT master race

Re:What I Learned Making My Own JIT Language by bjoli on Wednesday June 27, 2018 @05:34PM (#17412030)
As someone who has ported racket's for loops to guile scheme (or at least, re-implemented them without looking at the source of the original racket macros), a JIT has several benefits. There are some things that you just can't know at compile time, and hot paths/inline caches solve a lot of those things.

for example (for/list ([a (in-range a b c)]) (+ a 100)). Since in-range has to check when to end the loop, it has to know whether the loop goes in negative or positive direction (ie: to check the loop using < or >). If the values of a b c isn't known at compile time, the comparator has to be checked for each loop. This can potentially be very expensive, especially in an inner loop.

There are loads of optimizations that can be done much more efficiently/easily by a JIT. Store sinking, store/load forwarding, array bounds check elimination, value-range propagation and hyperblock scheduling to name a few.

LuaJIT is still the fastest dynamic language out there, but the complexity of the codebase surely makes you wish that wasn't the case.

Re:What I Learned Making My Own JIT Language by ufo on Wednesday June 27, 2018 @07:25PM (#17412767)
You can avoid the test by generating two loops (one that goes up and one that goes down). But that can lead to code bloat...
Re:What I Learned Making My Own JIT Language by TomMarius on Wednesday June 27, 2018 @03:45PM (#17411183)
What about WebAssembly? How would you provide the same guarantees and benefits without JITing or interpreting?