Unofficial Hacker News companion — get notified on comment replies, and more.

So, I rewrote my game in C3 (opens external site)

159 points by lerno 5 days ago | www.madrigalgames.com | 46 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (3)

  1. This is certainly also true. From the beginning C3 tried to keep codegen similar to Clang. After all, this is what LLVM is tested on, and it would be natural that these patterns work the best.

    To get even more mileage you can do some optimizations in the frontend, before LLVM lowering (as long as it won’t break debug) to reduce IR even further.

    Replies (1)
    1. Btw, more and more languages opt for a single compilation units, especially ones like Rust (and Zig i guess) where basically all dispatch is static and there's lots of duplicate work created by generic monomorphization (which might end up bloating binaries as well).

      Considering this, I think LLVM might want to add other methods of paralallelizing computation within a single compilation unit.

      Replies (1)
      1. And then you want to have incremental compilation, how? There's a reason why separate compilation was a thing.

        Furthermore, I believe the assumptions are built hard into LLVM.

        But I mean it's not even a problem. Even if you build everything monolithic (and we can debate the downsides of that), you can still create "virtual" modules in order to parallelize codegen. It's an extremely obvious win and it's dead simple. I'd be surprised if Zig doesn't do that. It's literally the first idea that would come to mind for speeding up "single compilation unit" languages.