6 ms·
This is interesting stuff. Could you comment about optimization? LLVM has put a lot of effort into optimizing code at various levels, including the LTO stuff. W
by pedrow 6y ago
This is interesting stuff. Could you comment about optimization? LLVM has put a lot of effort into optimizing code at various levels, including the LTO stuff. Will Zig match all this by itself, or will a 'Release mode' still use LLVM to produce a final version?
- kristoff_it 6y agoLLVM is still going to be used for release builds. As of now, the self-hosted backend is dedicated to producing debug builds without optimizations (and with a few extra runtime inefficiencies, as that's the price for faster in-place binary replacement).
- nick_ 6y agoThanks, that's the answer to my question :) Do you know if there has been any plans to implement this build-time optimization upstream in LLVM itself? Perhaps after it's been completed within Zig.
- alexnask 6y agoWhile I am not terribly familiar with the LLVM codebase, this kind of improvement would probably require massive internal changes. One example of this is the fact that codegen needs to be aware of the linker to emit correct code depending on the type of executable that is being generated, since different strategies can and are used for different formats (for example, currently the x86_64 backend will generate different instructions for function calls on ELF and PE/COFF vs MachO). I would totally get behind LLVM or other compiler toolchains working towards this kind of functionality, but this is hardly something Zig developers could implement in a massive project such as LLVM (which is precisely why we are building our own :))
- nick_ 6y agoVery interesting. It makes a lot of sense. Do you have a read on how well using the LLVM interpreter modes fill this gap? EDIT: To be clear, I mean the gap of slow build performance in the feedback look of code-build-check.
- theresistor 6y agoLLVM's interpreter is atrociously slow. It's only really meant for debugging LLVM itself.
- ndesaulniers 6y agoWe started looking at build times of the Linux kernel with Clang this summer. Turns out that compile times are dominated by Clang, not LLVM. Sounds like different experiences for different frontends.
- ikskuh 6y agoThe overall idea is to have a selfhosted compiler for debug and release builds where the release build as ~80% of LLVM performance and use LLVM as an optional dependency to go 100% performance
- jedisct1 6y agoThe self-hosted compiler is only going to be for debug builds AFAIK.