Live data from Hacker News

A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

carolchen.me

81–90 of 103 posts

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#81

This is a nit but looks like she says pyc files aren't around in python3 anymore -- they're still there just in the __pycache__ directory (as of 3.2)

I know Python does the dunders and all, but couldn’t they have at least stuck a dot in front of it if they wanted to move it out of the way :(

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#82

Earlier quoted context omitted.

Think of an use case where you have an API whose mode behavior is to do nothing, waiting for a call... but commonly gets calls that are very compute intense for short bursts of time. With the most common type of JITs, which profile once and compile once, I'm going to get code that is optimized for startup and initialization. If I have an "advanced" JIT, which is constantly deoptimizing and reoptimizing for whatever i…

The most commonly used JIT in the world is almost certainly the one in the OpenJDK, which is of the advanced kind. And it does not suffer from the problem you are talking about, because it only ever looks at code that is getting executed. Basically, it will do something like: interpret a function for a the first few thousand times it is executed, collecting execution metrics. After a threshold is reached, next time t…

> The most commonly used JIT in the world is almost certainly the one in the OpenJDK

I don’t know, there are a lot of people who browser the web using Chrome…

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#83
post #74

Earlier quoted context omitted.

Yes, allocation can be incrementally be made cheaper with a copying GC. But you have to realize that it still comes at a cost, and allocation speed isn't always a bottleneck. You have a runtime process intercepting your code state, scanning and analyzing your heap and making a decision to keep, copy, or free. For anything larger than a trivially small object graph, that additional processing can easily overwhelm any…

> You have a runtime process intercepting your code state, scanning and analyzing your heap and making a decision to keep, copy, or free. Most generational gc's don't call free (the ones in Java can, but not per object, the reason for doing it is for returning memory to the OS). The GC will scan every _living_ object, but only those it is interested in. So if the decision to be made is which newly allocated objects s…

Yup, and many GCs have the freedom to move objects around due to language semantics so they can do things like munmap pages if they want to rather than calling free.

> Pauses are less than 100ms (usually much lower) which is about the same variation I get from calling a third-party http service.

Note that a pause for calling a web service is different than a GC pause, because in the former you can do other useful things while you wait.

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#84
post #77

Earlier quoted context omitted.

But Rust is designed to be blazing fast in many aspects, even if it uses a traditional malloc/free. Most likely if you compare a Rust and Java program that both run a loop creating a million node linked list and then starting over, you'll see that the Java program is much faster. I'll actually try to do that and confirm, but I believe it should be the case. Even if you were to allocate arrays (Vec) you may see the sa…

Intel has contributed vectorization support, all the way to AVX.

To OpenJDK’s JIT? I’ll have to try that sometime on ArrayList.

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#85

Earlier quoted context omitted.

The most commonly used JIT in the world is almost certainly the one in the OpenJDK, which is of the advanced kind. And it does not suffer from the problem you are talking about, because it only ever looks at code that is getting executed. Basically, it will do something like: interpret a function for a the first few thousand times it is executed, collecting execution metrics. After a threshold is reached, next time t…

> The most commonly used JIT in the world is almost certainly the one in the OpenJDK I don’t know, there are a lot of people who browser the web using Chrome…

Oops, you're right, JS is certainly more commonly used, I forgot about that.

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#86

This is a nit but looks like she says pyc files aren't around in python3 anymore -- they're still there just in the __pycache__ directory (as of 3.2)

I know Python does the dunders and all, but couldn’t they have at least stuck a dot in front of it if they wanted to move it out of the way :(

That won't work on other operating systems anyway.

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#87

This article is really nice for not making things harder than they needed to be. Trace then substitute the trace - no magic. It seems like a big part of all these strategies is making sure the checks for the optimizations (checking if they're possible, checking if they're done) don't take more time than the optimizations save. Or could there be a way to alter the execution graph so that once you add in the optimizati…

> Or could there be a way to alter the execution graph so that once you add in the optimization, you never have to check if it's there?

One of the things V8 does is store "field dependencies" -- a list of optimized code attached to fields that is invalidated if that field is modified in a certain way. The optimized code is known to only access that field in a certain way, thus doesn't need to check it, so this only slows down unoptimized paths (and only on their slow paths too, since even unoptimized code has fast paths for known access patterns thanks to inline caches). Comes with a memory/generality cost though, so this isn't used for every type of check.

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#88
post #77

Earlier quoted context omitted.

Intel has contributed vectorization support, all the way to AVX.

To OpenJDK’s JIT? I’ll have to try that sometime on ArrayList.

Here, https://cr.openjdk.java.net/~vlivanov/talks/2017_Vectorizati...

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#89
post #10
post #9

Very nice. I just looked at the author's resume.[a] It appears she is still in, or only very recently graduated from, high school . Is that right? Impressive! [a] https://carolchen.me/

Yep, class of 2019, jit to actually have a physical prom and graduation

How does a high school kid get so interested in (and manages to pull off a great article about) stuff like Intermediate Representations, compiler optimisation techniques, JITs as different as those of Julia and GraalVM, that would easily scare even a seasoned programmer with years of experience and a CompSci degree under the belt?

Re: A Deep Introduction to JIT Compilers: JITs are not very Just-in-time

#90
Entirely off-topic, but the author's name when written without a space (i.e. Carolchen, as it is in the URL) just happens to be the diminutive of Carol in German. Except that Carol is not a very common name here at all, so rare in fact that I've not once met a German Carol. This had me very confused for a moment.
Post reply on HN