I guess "Nobody cares about your dead religion" :-)
Still, it would probably be faster, at the expense of being unreadable.
81–90 of 102 posts
I guess "Nobody cares about your dead religion" :-)
Still, it would probably be faster, at the expense of being unreadable.
As someone notes on the bug, if you were rolling your own, there are some other things you could do--return a [][]byte that's a pointer to its internal buffer, only usable until the next row is read. Making a version of encoding/csv that retains most of its features (custom delimiters, handling backslashes and quoting and \r) but streams like that would be a fun open source project for someone who likes Making Things…
Python's csv module uses an internal module _csv which is written in C. So I'm not sure it's all that surprising that a Go implementation is a bit slower.
But not sure if it matters. Go is free to use a C module to load csv files as well. It can use assembly or other tricks as well perhaps.
Earlier quoted context omitted.
I thought it is rather part of the solution/answer to the issue. It is expected to be slower, so it's not necessarily broken. Kind of it's a feature, not a bug.
If one language is 50% slower in file reading and a simple state mashine that iterates over an array, that's not a feature. Either the implementation or the compiler is lacking some optimization.
Earlier quoted context omitted.
But Java conceptually has a lot of drawbacks that require the JVM to have screaming performance to compensate for. Almost everything being a "headered" object being probably the worst offender. Even a slightly worse Go compiler is probably well compensated-for by denser data structure layout in the operating memory.
> Java conceptually has a lot of drawbacks In what sense is an articulated object a "conceptual drawback"? It is a richer object model and SMI and friends had the engineering chops to makes it highly performant.
Earlier quoted context omitted.
All 3 support UTF8. The difference with the Go implementation is the mostly useless capability to have a utf-8 multibyte item as the delimiter.
1. there's nothing useless about it 2. the Python 3 CSV library supports arbitrary codepoints as delimiter, quote character and escape character (if applicable)
Opportunity cost. It slows down the parsing for support of something that nobody has ever seen in the wild (not to mention it doesn't even match the name of the format, but let's get past that since we already use ; | and others).
Plus I can't even imagine a use case that would make it a good idea to use that over a simpler delimiter, or even the special purpose ASCII delimiter character. Can you?
On a related note, also the Go stdlib regex package is pretty naive and imperformant compared to a full blown and modern backtracking PCRE implementation (at 1/10 the LOC and complexity) - same thing goes for the reflection based JSON package (which is still kinda "fast enough"). The focus wasn't so much on performance but on initial completeness, good interface, versatility, clarity and simplicity - with faster or m…
In other words....C/C++ :) I just try not to blow off my leg.
The Java code is not a CSV parser. I added the results of using Apache Commons CSV to the GitHub thread. After using that, Python was actually by far the fastest. Hooray for performance sensitive code in C :)
Effectively one is comparing library performance here and not language performance. Granted, that line can get very blurry indeed, but in this case this says very little about golang the language and far more about a current implementation of one of the golang libraries.
It is kind of both; go doesn't allow some approaches in native go code that can make it slower than other languages. (I love go, but that is my experience.) In this case the choice to use utf-8 everywhere, including in the csv delimiters, is making it slower.