No idea how it holds up, it was my first try at a compiler, but it’s quite small. I was following the Crafting Interpreters book.
473 karma · joined November 25, 2023
No idea how it holds up, it was my first try at a compiler, but it’s quite small. I was following the Crafting Interpreters book.
I’d say that most C++ developers will generally have an easy time using Rust and will get equivalent performance.
But sometimes the project did not have a good reason to be in C++ in the first place and I’ve seen successful rewrites in Java for example.
Apple is rewriting some C++ code in Swift, etc. So, the language the team/company is comfortable with is a good rule of thumb.
The docs explicitly mention that invalid input will make it panic and that can be confirmed by reading the code or fuzzing the input.
From my understanding, there is no compile time schema so everything is done with runtime reflection and that is bound to not be super fast. Granted, JSON is the same on paper, I would guess that the JSON package had more eyes on it and optimizations.
In our case, everything was using JSON except this one component due to some historical oddity so it was also a win in terms of simplifying.
It panics on malformed input which is a no go for us since high availability is really important for us, and it showed quite a lot in the performance and memory profiles (roughly 5 times the time and memory as doing the same with JSON).
The code was converting some data to gob, and storing it in the database for later.
We now just do the same but in json, it’s human readable and Postgres validates that the data is valid JSON.
And unmarshaling it does not panic.