Live data from Hacker News

Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

github.com

41–46 of 46 posts

Re: Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

#41

Earlier quoted context omitted.

I don't follow. You can load every JITC I know of with C or C++ interfaces. And what is a JITC if not a runtime?

The runtime I'm talking about is for the language that the JIT compiler is written in. If I want to use a JIT compiler that is written in Java in my C++ game I now have to distribute the Java runtime with my game. That's an example of "not easily embeddable".

Two things here:

1. If by runtime you mean "set of files" you can (these days) compile the Graal JIT compiler to a fully standalone DSO/DLL or even statically link the results into a larger executable. And because the Graal JIT understands Truffle that means making standalone statically linkable JITCs for any language is now very easy.

But that said, games always consist of more than one file anyway so the importance of this doesn't seem too high.

2. If by runtime you mean "support code" then C, C++ and Rust all have runtimes so you'd really need to define what specifically you need from a runtime.

Re: Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

#42
post #16

Too bad it doesn't support SIMD. Would be nice for an easily embeddable SIMD-aware JIT to exist.

WebAssembly in something like wasmtime is probably the closest we've got to this. Though I wish WebAssembly supported more (wider) SIMD instructions.

Re: Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

#43

Earlier quoted context omitted.

The runtime I'm talking about is for the language that the JIT compiler is written in. If I want to use a JIT compiler that is written in Java in my C++ game I now have to distribute the Java runtime with my game. That's an example of "not easily embeddable".

Two things here: 1. If by runtime you mean "set of files" you can (these days) compile the Graal JIT compiler to a fully standalone DSO/DLL or even statically link the results into a larger executable. And because the Graal JIT understands Truffle that means making standalone statically linkable JITCs for any language is now very easy. But that said, games always consist of more than one file anyway so the importance…

I didn't know that about Graal but I guess it depends on how easy that process is. Remember we're talking about "easily embeddable". You can embed anything with enough effort!

Re: Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

#44

Earlier quoted context omitted.

TIL PHP uses dynasm, here I thought only LuaJIT did. Cool!

Here’s the RFC for reference https://wiki.php.net/rfc/jit It passed and landed in PHP 8.0.

I’m surprised their benchmark only saw a 200% performance improvement. LuaJIT is way faster than Lua in many cases.

Re: Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

#45

Earlier quoted context omitted.

Two things here: 1. If by runtime you mean "set of files" you can (these days) compile the Graal JIT compiler to a fully standalone DSO/DLL or even statically link the results into a larger executable. And because the Graal JIT understands Truffle that means making standalone statically linkable JITCs for any language is now very easy. But that said, games always consist of more than one file anyway so the importance…

I didn't know that about Graal but I guess it depends on how easy that process is. Remember we're talking about "easily embeddable". You can embed anything with enough effort!

See here for a guide on how to compile some Java code to a native library:

https://www.graalvm.org/latest/reference-manual/native-image...

One of the kinds of code you can compile this way is a language interpreter using the Truffle framework, which is a way to write interpreters that turns them into advanced JIT compilers automatically. If you do that then your language interpreter, runtime and the Graal/Truffle JIT compiler will all be compiled into your shared library. You can then export a C API from it using the technique shown in that article to load and execute code.

Re: Mir: Strongly typed IR to implement fast and lightweight interpreters and JITs

#46

Earlier quoted context omitted.

Here’s the RFC for reference https://wiki.php.net/rfc/jit It passed and landed in PHP 8.0.

I’m surprised their benchmark only saw a 200% performance improvement. LuaJIT is way faster than Lua in many cases.

So the PHP implementation was built into the opcache extension which already gives a massive speed up over purely interpreted PHP.

If you benchmark JIT PHP vs PHP with no opcache you will see 500% speed up or more depending on the workload.

Of course most PHP web servers tend to be pretty IO bound. The project I work on sees ~a 20% in best case response time which is quite nice.

Post reply on HN