News for hackers. Stuff that matters.
Re:Parsing Protobuf Like Never Before by 9rx on Thursday July 24, 2025 @11:35AM (#44671993)
> CPython is a C program

Go (gc) was also a C program originally. It still had the same overhead back then as it does now. The implementation language is immaterial. How things are implemented is what is significant. Go (tinygo), being a different implementation, can call C functions as fast as C can.

> ...so it can too.

In my experience, the C FFI overhead in CPython is significantly higher than Go (gc). How are you managing to avoid it?

Re:Parsing Protobuf Like Never Before by johnisgood on Thursday July 24, 2025 @04:23PM (#44675601)
I would like to know this, too.
Re:Parsing Protobuf Like Never Before by pornel on Friday July 25, 2025 @09:06AM (#44682707)
I think in case of CPython it's just Python being slow to do anything. There are costs of the interpreter, GIL, and conversion between Python's objects and low-level data representation, but the FFI boundary itself is just a trivial function call.
Re:Parsing Protobuf Like Never Before by 9rx on Friday July 25, 2025 @10:40AM (#44683666)
> but the FFI boundary itself is just a trivial function call.

Which no different than Go, or any other language under the sun. There is no way to call a C function other than trivially, as you put it. The overhead in both Python and Go is in doing all the things you have to do in order to get to that point.

A small handful of languages/implementations are designed to be like C so that they don't have to do all that preparation in order to call a C function. The earlier comment included CPython in them. But the question questioned how that is being pull off, as that isn't the default. By default, CPython carries tremendous overhead to call a C function — way more than Go.