-
Notifications
You must be signed in to change notification settings - Fork 142
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
Benchmark is wrong #52
Comments
So, an important update! Even my benchmark above is broken -
|
Hello @qezz
The command for the benchmark was written before the I'm glad you tried to replicate the results. I will investigate potential performance regressions as soon as I get some free time. |
I tried to replicate the results as well, even with the commit 324fd1c where the benchmarks were added to the README.md. But with no success, I can’t reach the advertised 11x either. As @qezz already mentioned, it seems like the benchmark is wrong:
My benchmark for the commit 324fd1c:
|
Issue
In benchmark, I've noticed that you weren't using
-p
option forsd
to print everything to stdout. Nevertheless,sed
-commands print everything to stdout.Also, once
sd "(\w+)" "$1$1" dump.json >/dev/null
is performed, every word in file is deleted. This happens because$1
is replaced by shell with(empty string)
andsd
performs 'in-place' (or 'inline') replacement.Experiment
Here is my run for a simple thing
Please pay attention to the second
cat
output.This is the reason why almost every run of
sd
is so fast (except the first one) — it doesn't do anything but just reading the file.The following command should be used to compete with
sed
:Please note the escaped groups
\$1
and the preview option-p
Experiment Results
Here are my results for a 120 MB file
Thoughts
Even if we fixed the benchmark, I do think that we are capped with pipe throughput.UPD: Ok, apparently pipe is not a problem.
Platform
MBP 2015, 2.7 GHz Intel Core i5
The text was updated successfully, but these errors were encountered: