Hacker News new | ask | show | jobs
by p0nce 14 hours ago
I didn't know 90% of that, it is heartwarming to see significant back and forth.
1 comments

The null check thing is actually really interesting cuz Rikki upstreamed the dmd impl but nobody's touched the ldc impl yet upstream. (I merged dmd and ldc in opend pretty early just because I had to reduce friction to make it all maintainable long term and that has indeed been a big win, I don't think either the null or objec things would have happened without streamlining the dev work like this)

My experience was the ldc impl was MUCH easier.... and optimizes much better, no surprise, but also compiled WAY slower. On dmd, the null checks barely affected compile speeds at all, but on ldc, the runtime impact isn't bad... but the compile time hit is ENORMOUS. I didn't even notice it at first, because I mostly use ldc just for cross compiles (another thing opend makes easy, `opend install xpack-win64` for example makes Windows builds just work, and it can do icons built in without third party toolchain as well, something hipreme took to upstream via his redub program that copied my implementation. he then added similar for Mac but I havent' pulled that back to opend yet, i will though) and I misdiagnosed.

Went looking for why the compile times were so much worse in opend ldc vs upstream (and btw note my definition of "so much worse" is like 3 seconds instead of 2 seconds, 50% is signifcant) and tried PGO and diffs in codegen and llvm versions...... then realized no, it is the null checks.

So the ldc implementation was easy and seems bug free (the bugs rikki fixed were in obscure corners of dmd's backend), and it optimizes well for runtime..... but wow it takes its sweet time to do that optimization. I'd appreciate someone else taking a look at that some day since there might be some better way to do it than I did (i basically copied the RangeError implementation on pointers for null check).

But I expect some day it'll come and then hopefully we'll make both of our compilers better.