Live data from Hacker News

I sped up serde_json strings by 20%

purplesyringa.moe

121–124 of 124 posts

Re: I sped up serde_json strings by 20%

#121
post #112

Earlier quoted context omitted.

Moment you add something to std it's effectively died. Strong backwards guarantees will choke development of library. Python std is where libraries go to die.

Who says that's a bad thing ? Sometimes things are good enough and just need to be vetted and maintained.

Rarely that's ever true. Hardware and software assumption will change over time. E.g. Simd is rare and not available to 99% of hardware has it, pointer is 16/32/64 bit wide, that API is available, SGML/JSON/XML is all parsing you will ever need.

Re: I sped up serde_json strings by 20%

#122
post #59

Earlier quoted context omitted.

This is so on-point. Number of dependencies is correlated with ease of package management. If you have a well-working package manager you're more likely to use a dependency than just rewrite that little part of your code. For little programs written in C or C++ this usually means that people write their own buggy CLI parsing that doesn't produce a proper help message and segfaults with the wrong combination of argume…

> Number of dependencies is correlated with ease of package management. I disagree with this, Python makes it trivial to add dependencies. [1] And yet Python developers tend to have the mentality of an older generation of software developers, pre-node/npm, and believe in keeping most things light. That starts with the language maintainers having a vision that says this should be possible , by including the batteries…

> I disagree with this, Python makes it trivial to add dependencies.

In python it's surely easier to add dependencies than C/C++, but it's harder than in Rust and not so trivial. Everyone using your script has to manually run pip to _globally_ install dependencies, unless you use virtual environments which can take a requirements.txt file, which just show how the builtin dependency management is not enough.

> When I'm writing Rust, I eternally have the infuriating dilemma of picking which dependency to use for a relatively common operation.

Likewise in python you might wonder which library to use between urllib, urllib2, urllib3 and reqwest. People not familiar with python might even fail to guess which ones are part of the stdlib.

Granted that's just one specific example, but it shows pretty nicely how there will always be a library with a better design and a stdlib module that's good enough right now will likely not hold the test of time, ultimately resulting in bloat.

Re: I sped up serde_json strings by 20%

#123
post #56

Earlier quoted context omitted.

Rust has a great package manager, so moving libs into std doesn’t bring much benefit. On the other hand a change like this perf improvement can be released without tying it to a language version, that’s good too.

> On the other hand a change like this perf improvement can be released without tying it to a language version, that’s good too. And you pay for that by having literally no way to parse something ubiquitous like json out of the box on install, relying to either installing third party lib (which is yet another security attack vector, requires yet another approval for upgrade, API can change on a whim by maintainer and…

I think you can consider a few extremely common crates (serde, tokio, etc.) to basically not be "third-party". The risk that dtolnay will randomly break serde_json is not meaningfully different from the risk that the rust core team will randomly break the standard library.

> requires yet another approval for upgrade

Approval from whom?

Re: I sped up serde_json strings by 20%

#124
post #3

Serde json has 3gb of dependencies once you do a build for debug and a build for release. Use serde on a few active projects and you run out of disk space. I don’t know why json parsing needs 3gb of dependencies. I’m all for code reuse but Serde for json is a bit of a dogs breakfast when it comes to dependencies. all you need is an exploit in on of those dependencies and half of the rust ecosystem is vulnerable. Rust…

I just added `serde_json` to my small GUI program. It alone increased the binary size from 6Mb to 8Mb; unacceptable for what it does.
Post reply on HN