5 ms·
JSON 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
by RX14 7y ago
JSON 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.