3 ms·
I think you have to use each tool for what it's for. Golang is useful for high performance stuff, yet it's easy enough to handle an HTTP request and parse JSON,
by jgimenez 9y ago
I think you have to use each tool for what it's for. Golang is useful for high performance stuff, yet it's easy enough to handle an HTTP request and parse JSON, for example.
Of course if you compare it with other options, you will find solutions that provide better expressiveness with less code (development speed), at expense of execution speed, type safety,...
- stock_toaster 9y agoI would say that while it is easy to parse json, it only remains easy if your json is straightforward and/or "well formed". If your json is... less well formed, you're going to have a much harder time parsing it with Go (and parsing it with good performance).
- inimino 9y agoWhat do you mean by "well formed"?
- stock_toaster 9y agoI mean one which doesn't have many similar, but variable, content structures, and/or which depending on the attributes of one of the elements. I had to deal with large volumes of json (think log streams) that while they shared many top level attributes, also had had accreted many "optional" components with "types" that depended on the values of certain attributes (each with different nested elements too). While awkward to deal with in python (lots of `if x in y['thing']` checks), this was very cumbersome to deal with in Go. It required lots of reflection and ended up being comparatively slow (python json parsing is actually pretty zippy). It just isn't one of Go's stronger suits in my opinion.
- inimino 9y agoOK. Interesting. One of the benefits of JSON is that it is ad-hoc extensible. Otherwise why not use an efficient binary format? When more strongly typed environments add JSON support they often screw this up, which is unfortunate. Maybe an opportunity for someone to write another library to better support more idiomatic usage of JSON.
- stock_toaster 9y agoYup. I agree with pretty much everything you said.