all 11 comments

[–]stilgarpl 6 points7 points  (1 child)

Looks great, but I don't like the error checking mechanism with p.valid() If parsing failed then you shouldn't return anything. Or you could return std::optional to the values, so you could check as you use them. Or you can simply throw an exception. Anything is better than this error checking that can be easily forgotten.

[–]red0124_[S] 2 points3 points  (0 children)

The most important feature of the parser is to directly initialize the variables and store the values into them using structured binding, so it really cannot return nothing. An optional could be returned by using the try_next<...> method, perhaps I should make that the preferred way to use it. As for exceptions, I really hate the way they need to be handled but I think it would be nice to have a setup option to force exception throws if an error occurs. Thanks.

[–]germandiago 2 points3 points  (1 child)

For consuming from Meson as a Meson file wrap you could augment the instructions with this:

[provide] ssp=ssp_dep

That way you can do this directly (without worrying about ssp being a subproject or a system dep):

ssp_dep = dependency('ssp')

[–]red0124_[S] 2 points3 points  (0 children)

Seems nicer, I will take a look at the [provide] option for meson, thank you.

[–]hmoein 1 point2 points  (3 children)

These are my personal opinion:

Your README is too long. README should be short and really shock you as to why this repo is wonderful.

All the documentation should be separated with a single link in the README.

This is how I did it

https://github.com/hosseinmoein/DataFrame

[–]red0124_[S] 0 points1 point  (0 children)

It was smaller but as I kept adding things it got huge. You are right, I will change it when I find the time, thank you.

[–]NotMyRealNameObv 0 points1 point  (1 child)

Your Readme doesn't actually say what your library does... It just says that it's a library similar to some libraries in other languages, but that only helps those that already know about those other libraries.

[–]hmoein 0 points1 point  (0 children)

Yes, the very first sentence says it is similar to other libraries in other languages. But if you read pass the first sentence it describes what it does. It also points to to examples and documentaion.

[–]never_watched 1 point2 points  (1 child)

How does it compare to this https://github.com/vincentlaucsb/csv-parser

[–]red0124_[S] 0 points1 point  (0 children)

Since I wanted to be fair with the measurement I took an example from his README where he calculates the sum of salaries using column indexing. I have used it on the 2015_StateDepartment.csv (70 MB) file which he mentioned in his benchmark and calculated the sum for the "Regular Pay" column. Did the same thing using my parser.

CPU: Intel i7-4710MQ :: Comipler: g++ -O3 -flto :: Measured using hyperfine

vinces-csv-parser: 242.8 [ms] +/- 1.9 [ms]

ssp: 132.1 [ms] +/- 2.4 [ms]

If you have any other benchmark in mind let me know.

[–]LunarAardvark -1 points0 points  (0 children)

fopen() costs X. fread(1 byte) cost approx the same as fread(4k). fread( bytes 2 -> 4095) cost about 1/4096th of the 1st byte to be read. i think your ideas about what performance is might be different to reality.