News for hackers. Stuff that matters.
Re:C/C++ vs. Rust Performance by matklad on Sunday November 01, 2020 @04:07PM (#24962510)
This is an exceptionally great article, which indeed discusses strong Rust limitations.

I have one question: the parser in the article uses computed goto, which, as far as I know, is not standard C. Are there many cases where even the standard goto yields significantly better performance?

Re:C/C++ vs. Rust Performance by krizhanovsky on Monday November 02, 2020 @10:56AM (#24969453)
Thank you, I'm glad that you enjoyed the article!

Regarding computed and simple goto I'd like to reference our early article discussing the parser in standard goto https://natsys-lab.blogspot.com/2014/11/the-fast-finite-stat... . My recent talk at scale https://www.socallinuxexpo.org/scale/17x/presentations/fast-... (watch videohttps://www.youtube.com/watch?v=LQc4er8ng64&feature=youtu.be... and slides at http://www.tempesta-tech.com/research/http_str.pdf ) discusses the parser with the compiler extensions.

We also found hat Ragel parser generator (using the goto state machine) generated somewhat faster large state machines than Bison (switch-drived state machine). However, as pointed out in the SCALE talk goto works better only on big enough state machines.

Re:C/C++ vs. Rust Performance by ncmncm on Sunday November 01, 2020 @10:42PM (#24964650)
This is an exceptionally bad article, packed to the brim with unambiguous falsehoods.

It is very unlikely that the computed gotos make the parser faster than using standard features of a more powerful language.

Re:C/C++ vs. Rust Performance by alok-g on Monday November 02, 2020 @10:42AM (#24969286)
>> It is very unlikely that the computed gotos make the parser faster than using standard features of a more powerful language.

Can you explain more on how? Use case I have in mind is bytecode interpretation where computed goto should be a big help.

Re:C/C++ vs. Rust Performance by ncmncm on Monday November 02, 2020 @02:35PM (#24972131)
Optimized tail calls are effectively the same as computed goto, but are a Standard feature. Or, rather, don't require non-standard syntax. A program that relies on the optimization built by a compiler that failed to implement it--which is allowed--would not be expected to run well.

https://github.com/ncm/computed-goto

The "more powerful language" part is to get language-level tools to compose parser combinators, ultimately resolving down to tail calls.

Re:C/C++ vs. Rust Performance by krizhanovsky on Wednesday November 04, 2020 @02:06PM (#24991984)
The benchmarks https://github.com/ncm/computed-goto/blob/master/benchmarks/... benchmark is not applicable to this discussion because it compares _too_ small state machines. I reference my talk and presentation once more: http://www.tempesta-tech.com/research/http_str.pdf - slide 23 discusses that the goto FSM makes sense for _hundreds_ of states.
Re:C/C++ vs. Rust Performance by ncmncm on Wednesday November 04, 2020 @11:17PM (#24995619)
The number of states is irrelevant. An optimized tail call is achieved with, exactly, a single branch instruction.