11,168 karma · joined Feb 25, 2014 (12y ago) · 5,386 submissions
comment 3w ago · link · parent
Linus doesn't agree. He once said in an interview that making Linux GPL'd was definitely the best thing I ever did, [0] and has said that I love GPLv2. I really think the license has been one of the defining factors in the success of Linux because it enforced that you have to give back. [1]
[0] https://web.archive.org/web/20070826212454/http:/www.tlug.jp...
[1] https://www.zdnet.com/article/linus-torvaldss-love-hate-rela...
comment 3w ago · link · parent
That's not correct. Gforth features a JIT compiler, although they don't call it that, they call it dynamic superinstructions. It will be enabled if you run gforth-fast. If I understand correctly, the native code sequences are always generated at runtime, and cannot be baked into an image file.
• Dynamic Superinstructions https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Dyn...
• [PDF] Code-Copying Compilation in Production An Experience Report (2025) http://www.euroforth.org/ef25/papers/ertl.pdf
comment 3w ago · link · parent
fallat said they were interested in teaching a 'grassroots' language. By that I think they mean something with a minimal core language and compact interpreter, so Forth seems like the better fit.
comment 3w ago · link · parent
In Forth's defence, other languages also have tricky subtleties, e.g. C++. Neither language prioritises theoretical purity, of course. They would be very different languages, with different drawbacks and advantages, if they did.
Both papers touch on whether the behaviours of certain unusual Forth constructs are well-defined according to the ANS Forth language standard. This sort of discussion should be quite familiar to C++ programmers.
[0] State-smartness - Why it is Evil and How to Exorcise it (Ertl, 1998) http://www.euroforth.org/ef98/ertl98.pdf
[1] State-smartness: Applications, Pitfalls, Alternatives (Ertl, 2001) https://www.complang.tuwien.ac.at/papers/ertl01state.pdf
comment 1mo ago · link · parent
A 12% difference in performance between two compilers, for some given application, is possible even between two of the best optimising compilers available. A 12% performance lag does not necessarily relegate a compiler to obscurity.
The long-entrenched MSVC compiler is still a major player despite that, for at least some applications and for at least some compiler versions, Clang outperforms it by far more than 12%. [0][1]
If a new Rust compiler really could offer significantly fewer compiler bugs, that would of course need to be weighed against any performance penalty, and the proper tradeoff would of course depend on the project.
> I agree that this is an impressive feat. I also don't see why an equivalent for rust would be adopted.
I imagine it wouldn't be widely adopted for most applications. CompCert itself is pretty niche. It's not Free and Open Source software, which I suspect is a factor, alongside its technical drawbacks.
Unless you're working on ultra-low-defect software, such as in a safety-critical domain, compiler bugs are unlikely to be a major factor in your software's quality. If the compiler lacks support for interesting language features, it becomes an even harder sell for 'ordinary' projects that are able to tolerate an ordinary number of compiler bugs.
[0] https://lemire.me/blog/2023/02/27/visual-studio-versus-clang...
[1] https://discuss.python.org/t/using-clang-cl-for-better-perfo...
comment 1mo ago · link · parent
I wouldn't say so. The gap between GCC and Clang/LLVM is bigger than that on some benchmarks, [0] although the gap between their overall performance (using geometric mean) is much less. [1]
It's a very impressive result considering how much effort has gone into GCC. It highlights how compiler optimisation work can face diminishing returns.
> the norm for releases being O2 if I understand correctly
Agreed, but the difference isn't that great. From the article:
> CompCert code is 7% slower than gcc-01 and 12% slower than gcc-02 on average.
Reminds me of how the cproc/qbe C compiler gets very roughly 50% of the performance of Clang/LLVM in 0.1% the lines-of-code. [2]
[0] https://www.phoronix.com/review/gcc-16-vs-clang-22/3
[1] https://www.phoronix.com/review/gcc-16-vs-clang-22/6
[2] https://drewdevault.com/talks/qbe/ (and see the linked slideshow PDF, as the abstract is a little misleading)
comment 1mo ago · link · parent
This 2022 article [0] says it generates binaries that run about 7% slower than what GCC produces with -O1.
[0] https://www.cs.cornell.edu/courses/cs6120/2022sp/blog/compce...
comment 1mo ago · link · parent
They are not. When discovered, they are still big news. With few exceptions, businesses (and other institutions) continue to treat the cloud providers' VM-as-a-service offerings as secure. AI can aid the defenders too.
> So everyone should be considering how to bake better security into the their runtimes.
If VM isolation is not trustworthy, my first concern would be whether the other VMs on the physical host machine might do something malicious and break into my VM.
comment 1mo ago · link · parent
I'm no expert but I suspect jcranmer's comment has it right that you end up doing cross-function register-allocation while foregoing the other benefits of just inlining. I also suspect the payoff would be minimal on modern heavyweight hardware. I can see it making more of a difference on a very minimal embedded processor, or if optimising for the smallest binary possible.
comment 1mo ago · link · parent
That's good, but it seems like how-hanging fruit. Boost offers intrusive_prt for this. [0]
make_shared goes half way, and performs a single allocation to return a shared_ptr to a new object. It eventually made its way from Boost to the standard. [1][2]
See also [3] which contrasts the two. (As you can imagine, intrusive_prt is slightly more efficient.)
[0] https://www.boost.org/doc/libs/latest/libs/smart_ptr/doc/htm...
[1] https://www.boost.org/doc/libs/latest/libs/smart_ptr/doc/htm...
[2] https://en.cppreference.com/cpp/memory/shared_ptr/make_share...
comment 1mo ago · link · parent
I figure it would be possible to add support for deletions, but it would cost us: we would lose guaranteed contiguous placement of elements with neighbouring indices, and (unless no deletions are made) we'd need a private data structure to correspond vector indices to addresses, and to determine where to locate new elements. This would of course bring us back to continually paying the price of indirection overhead, and simple lock-free modifications would not be possible.
My completely unsupported guess is the cache behaviour wouldn't be too bad unless deletions (of elements that aren't at the end of the vector) are common. I imagine the cache behaviour of a linked list must depend greatly on what the allocator gives you. Presumably using a pool, specific to that particular list, could help there.
comment 1mo ago · link · parent
https://www.boost.org/doc/libs/1_92_0/doc/html/container/non...
comment 1mo ago · link · parent
The Linux kernel uses them, at least some of the time they're used with their lock-free RCU pattern. I'm not sure if it's for performance reasons though, I think they're using it in contexts where correctness requires the absence of blocking operations.
I'd expect a lock-free non-linked-list solution would also be possible, but I don't know enough to state that definitively.
comment 1mo ago · link · parent
creata's comment [0] mentions the works of Agner Fog, which seem very good, and are freely available.
I haven't read C++ High Performance [1] but it looks like it covers the sorts of topics you'd expect, although it looks like it doesn't cover computer architecture in detail e.g. branch prediction. There are books on that too, of course.
[0] https://news.ycombinator.com/item?id=49868657
[1] https://www.packtpub.com/en-us/product/c-high-performance-97...
comment 1mo ago · link · parent
What you've written mostly makes sense to someone who already has a solid understanding of SIMD and of C++ (although I can't say I follow all of it), but the target audience is people who don't. For them, each point needs a much lengthier explanation.
comment 1mo ago · link · parent
High-performance programming is a big topic. The scope is far too broad for a single blog post, which naturally gives only cursory discussion of C++ and computer architecture. The article isn't bad considering, but I do think it's the wrong format. A blog series, or even a book, would be more fitting.