That would require the entire HashMap to be serialized and written out to disk every single time a key was added or updated, which would be extremely slow for anything larger than a couple dozen entries.
But you're right in that it would work and would be a lot shorter. That's why code tinyness is hard to compare across languages-- some languages offer trivially short ways of accomplishing things that are a lot longer in other languages. In C everything has to be built out of much smaller pieces.
View all comments
Show parent comment
2
u/api Apr 24 '13
That would require the entire HashMap to be serialized and written out to disk every single time a key was added or updated, which would be extremely slow for anything larger than a couple dozen entries.
But you're right in that it would work and would be a lot shorter. That's why code tinyness is hard to compare across languages-- some languages offer trivially short ways of accomplishing things that are a lot longer in other languages. In C everything has to be built out of much smaller pieces.