3 ms·
JSON is a really bad way to benchmark a language because it's often implemented in a different language. Much better to implement a small program entirely in t
by IshKebab 7y ago
JSON is a really bad way to benchmark a language because it's often implemented in a different language.
Much better to implement a small program entirely in that language, along the lines of the benchmark game.
- RX14 7y agoJSON is actually implemented entirely in Crystal for Crystal, I'm pretty sure it's the same for Nim too. For a language which claims to be fast, having to use a C-based JSON parser would be a bit of a cop-out :)
- sweeneyrod 7y agoBut using an existing parser that happens to be written in C could definitely be sensible.
- imtringued 7y agoThat sounds like a pretty awful idea. If you're using a C library for parsing JSON then you must add an additional C to Nim/Crystal conversion step that requires additional RAM and CPU time.
- mratsim 7y agoNim compiles to C, there is no cost in calling C.
- sweeneyrod 7y agoThat's not how people use C libraries.
- SolitudeSF 7y agothats not how it works
- RX14 7y agoYes, we do so for more complex formats like YAML and XML. However, for JSON, reimplementing is worth it for binary portability.
- SolitudeSF 7y agoit still compares algorithm implementation, not the language speed.