Re:Part 2 Dart vs Go vs Python (and PyPy) Performance
by fdr on Wednesday April 11, 2012 @09:10PM
(#3830482)
I don't think so; I think Golang could use a more well-optimized parser implementation, even if it remains written in Go.
[ Parent
| on HN ]
Re:Part 2 Dart vs Go vs Python (and PyPy) Performance
by supersillyus on Thursday April 12, 2012 @12:18AM
(#3831001)
It certainly could be more optimized.
For example, all numeric literals are converted to strings before being parsed. That's a mostly unnecessary copy/allocation per number.
Similarly, it doesn't make use of the fact that a []T can only legally contain Ts. It's all very clean and generic, which is great, because when working on the compiler they can work on making good code faster without being mislead by code that tries to work around lack of optimizations.
As an experiment, I replaced the []int in the Go code in the link with an IntList that implements json.Unmarshaler, and does a single-pass integer list parsing there (without overflow checking, but eh). With that quick 40 line change, the Go code was faster than the CPython, at least on my machine.
That and similar type-specific handling could be built into the json package fairly easily, and would make those cases quite a bit faster. Then again, I bet the Go team would have a better and more general idea.
Re:Part 2 Dart vs Go vs Python (and PyPy) Performance
by mdwrigh2 on Thursday April 12, 2012 @12:32AM
(#3831038)
I spun the JSON decoding off into a few goroutines and managed to get it down to ~1second (but it was out of order, so didn't quite solve the same problem - though this is fixable). This is was ~10 lines of Go (and only using a single core).
Re:Part 2 Dart vs Go vs Python (and PyPy) Performance
by Teef on Thursday April 12, 2012 @09:09AM
(#3832137)
This was my bad I have updated the post. I should have been marsheling to a more comparable datatype (map[string]interface{}{}) and now the performance is more in line with what I would expect. I need to look into the Unmarshal code to see why this is so slow.
Re:Part 2 Dart vs Go vs Python (and PyPy) Performance
by eternalban on Wednesday April 11, 2012 @09:39PM
(#3830581)
I appreciate why you use "golang" instead of the general "Go" or current release "Go1", but the former is the name of the open source organization, and the latter is the name of the language.
Re:Part 2 Dart vs Go vs Python (and PyPy) Performance
by enneff on Thursday April 12, 2012 @03:28AM
(#3831402)
You are mistaken. There is no organization that maintains the Go project. The project and language are both named Go.
"golang" is just the name of the domain and a more searchable term than "go." There is nothing more to it than that.