7 ms·
I measured once and to my surprise templates aren't (directly) the reason for long compile times. It's function bodies in headers, and obviously templates are i
by levodelellis 7mo ago
I measured once and to my surprise templates aren't (directly) the reason for long compile times. It's function bodies in headers, and obviously templates are in headers and they call other templated functions/classes which explodes code generation and time. But if it's only a few lines and doesn't call other templated functions it's likely fine. I wrote about it here https://bolinlang.com/wheres-my-compile-time https://bolinlang.com/wheres-my-compile-time
After writing that, I wrote my own standard library (it has data structs like vector, hashmap and sets; slices, strings, rng, print, some io functions, and more) which uses a lot of templates, and it compiles in <200ms on both clang and gcc. Many standard library headers take much longer to compile than that. It's not a terrible idea to have your own standard lib if you need quick compile times.
- direwolf20 7mo agoYour website seems to be blocking Tor
- levodelellis 7mo agoOh? I use a boring old $5 VPS (using nginx for https). There's no cloudflare or anything else involved. I wonder why that's happening. I may look into that this week
- direwolf20 7mo agoIt could also just be down. I didn't try outside of Tor
- rustyhancock 7mo agoAnother option can be if you have a core set of headers your project will use (and is stable) just precompiling them.