-
Notifications
You must be signed in to change notification settings - Fork 28
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
Refactored some of the code and added in extract lines performance #15
base: master
Are you sure you want to change the base?
Conversation
Hello, thanks for your contribution, but I cannot merge this before I know for sure this is better than original version. How did you verified your code is faster? Can you post some test results? |
Makes total sense! I just added a test that computes how long it currently takes to go through a ~27k line file. It doesn't give you much context as it is not running against the previous version though. I can upload my own benchmark file if you want, and for now will just post the results here. I used the test helpers in this PR along with these functions to compare the old and new version of node-readlines.
Where movies was 27k lines and ratings was 20m lines. The results were
Ran this multiple times, and the movies file was consistently ~50% better, and the ratings file was consistently ~35% better. |
Looks like I am having some white space issue.
My text editor is saying spaces: 4.
What are you using?
edit: I think I resolved the whitespace issues.
Found this super useful btw! Not many good options for synchronously reading line by line while not all in memory.
Also if you don't want the dependency, we can check to see if Buffer.indexOf is supported, and if not use the old
_extractLines
function.