8 ms·
If you use the normal toolchains for C vs another language, the other language still can be faster because it can dynamically generate bytecode based on runtime
by tylerhou 6y ago
If you use the normal toolchains for C vs another language, the other language still can be faster because it can dynamically generate bytecode based on runtime information. In the normal C toolchain, this is not possible.
However, if you used an alterative toolchain that could also generate bytecode from C at runtime, then I would bet that C would stay on top or be equal.
- thysultan 6y agoYou can literally emit runtime assembly in C in any C toolchain, what are you on about?
- tylerhou 6y agoHow do you dynamically generate machine code without linking something like LLVM?
- sgtnoodle 6y agoI believe that's actually what folk are doing these days, literally linking in LLVM and using it to compile C into machine code then executing it during runtime.
- tylerhou 6y agoThat's what I mean by "alternative toolchain," though; some of the code that you are executing at runtime isn't being generated by the normal GCC/Clang toolchain. It's being generated by your custom setup which links in LLVM. You'd still need to compile your code with a regular toolchain, but you also need additional tools to compile, optimize, and debug code at runtime. That's what I meant by toolchain, even if it is not the conventional (static) definition.
- thysultan 6y agosame way you would with llvm, you can map executable memory without llvm and execute it.