Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: please support parsing to Vector[String] rather than List[String] #76

Closed
benhutchison opened this issue May 6, 2016 · 2 comments

Comments

@benhutchison
Copy link

When accessing a collections by numeric index, Vector has much better performance than List, effective constant time vs linear for List [http://docs.scala-lang.org/overviews/collections/performance-characteristics.html]. Indexed access is very common for CSV data.

It is unfortunate that CSVParser currently uses a Vector internally, but then converts to a less-optimal List before returning to client.

It would be easy to support parsing to Vector by introducing a parseVectormethod that doesnt convert to List, and then calling that from a parsemethod returning List, to maintain compatiblity.

Happy to send a PR if you are open to this idea?

@tototoshi
Copy link
Owner

I think this is not so important from the point of view of performance, because the list of fields are not so long.
However, it was a big mistake to use List[String] as the type of interface. It has no reason to be List[String]. I will change it to Seq[String] and use Vector as implementation in the future.

@tototoshi
Copy link
Owner

#99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants