← Back to context

Comment by crawshaw

11 days ago

It is great that Fil-C exists. This is the sort of technique that is very effective for real programs, but that developers are convinced does not work. Existence proofs cut through long circular arguments.

What do the benchmarks look like? My main concern with this approach would be that the performance envelope would eliminate it for the use-cases where C/C++ are still popular. If throughput/latency/footprint are too similar to using Go or what have you, there end up being far fewer situations in which you would reach for it.

  • Some programs run as fast as normally. That's admittedly not super common, but it happens.

    Some programs have a ~4x slowdown. That's also not super common, but it happens.

    Most programs are somewhere in the middle.

    > for the use-cases where C/C++ are still popular

    This is a myth. 99% of the C/C++ code you are using right now is not perf sensitive. It's written in C or C++ because:

    - That's what it was originally written in and nobody bothered to write a better version in any other language.

    - The code depends on a C/C++ library and there doesn't exist a high quality binding for that library in any other language, which forces the dev to write code in C/C++.

    - C/C++ provides the best level of abstraction (memory and syscalls) for the use case.

    Great examples are things like shells and text editors, where the syscalls you want to use are exposed at the highest level of fidelity in libc and if you wrote your code in any other language you'd be constrained by that language's library's limited (and perpetually outdated) view of those syscalls.

    • While there are certainly other reasons C/C++ get used in new projects, I think 99% not being performance or footprint sensitive is way overstating it. There's tons of embedded use cases where a GC is not going to fly just from a code size perspective, let alone latency. That's mostly where I've often seen C (not C++) for new programs. Also, if Chrome gets 2x slower I'll finally switch back to Firefox. That's tens of millions of lines of performance-sensitive C++ right there.

      That actually brings up another question: how would trying to run a JIT like V8 inside Fil-C go? I assume there would have to be some bypass/exit before jumping to generated code - would there need to be other adjustments?

      41 replies →

    • > Some programs have a ~4x slowdown

      How does it compare to something like RLBox?

      > This is a myth. 99% of the C/C++ code you are using right now is not perf sensitive.

      I don't think that's true, or at best its a very contorted definition of "perf sensitive". Most code is performance sensitive in my opinion - even shitty code written in Python or Ruby. I would like it to be faster. Take Asciidoctor for example. Is that "performance sensitive"? Hell yes!

      6 replies →

    • There’s loads of good shells and text editors written in other languages.

      I’m the author of a shell written in Go and it’s more capable than Zsh.

      3 replies →

    • Very good answer and agree. There seems to be a psychological component wrapped up in the mythology versus the reality of what's necessary.

    • > Great examples are things like shells and text editors

      I regularly get annoyed that my shell and text editor is slow :-)

      I do agree on principle, though.

That has been the qualm of programming since the Assembly days, unfortunately most developers aren't Ivan Suntherland, Alan Kay, Steve Jobs, Bret Victor, and other similar minded visionaries.

Most of us sadly cargo cult urban myths and only believe in what is running in front of them like Saint Thomas, as to have any kind of feeling how great some things could be like.

Hence why so many UNIX and C clones, instead of creating something new, to be honest those two guys were also visionaries despite some of the flaws, back in 1970's.