-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
filter2 command is too slow #269
Comments
Yes, I noticed that. It is slow :( |
Can we move the Expression parsing function outside the for-loop and run it only once? |
It is slow, but it must be done like that. Cause |
Why filterStr1 is different? Can we cache the parsed results? |
It's the expression, like '$age > 18', the |
Yes. I mean can we parsed the expression as something like '$1>18' and reuse the code of the filter command to deal with the computation afterward |
God, it's really slow~ I used it a lot recently. Have to improve it, when I have time ~ |
It's fixed. Please update it to v0.31.1. https://github.com/shenwei356/csvtk/releases/tag/v0.31.1 The problem is in the parameter preparation step, not the expression evaluation. d20aa89 |
Compared with filter command or awk, fiter2 command is much slower, especially for rule with multiple conditions.
It might be relative to this function in the for-loop, which repeatedly parsing the expression.
csvtk/csvtk/cmd/filter2.go
Lines 370 to 376 in 9407f73
The text was updated successfully, but these errors were encountered: