Closed kytta closed 2 years ago
I can't reproduce this. For me, the C client is fast enough that time
can't display a non-zero value for a single run:
$ time bash -c 'seq 10 | xargs -I % time /usr/local/bin/tldr grep >/dev/null'
0.01 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
0.00 real 0.00 user 0.00 sys
real 0m0.136s
user 0m0.041s
sys 0m0.055s
$ time bash -c 'seq 10 | xargs -I % time python -m tldr grep >/dev/null'
0.28 real 0.09 user 0.07 sys
0.21 real 0.09 user 0.07 sys
0.21 real 0.09 user 0.07 sys
0.21 real 0.09 user 0.07 sys
0.20 real 0.09 user 0.07 sys
0.21 real 0.10 user 0.07 sys
0.51 real 0.10 user 0.08 sys
0.22 real 0.10 user 0.08 sys
0.80 real 0.10 user 0.08 sys
0.22 real 0.09 user 0.08 sys
real 0m3.188s
user 0m1.001s
sys 0m0.825s
I am using macOS 11.6.5 on an x86_64 machine. I'm using v1.4.3 of the C client and v3.1.0 of the Python client with Python 3.7.13.
Are you sure that your Python client is not just failing very quickly? Yours seems to take around as long as it takes for my interpreter to start and print an empty line:
$ time bash -c 'seq 10 | xargs -I % time python -c "print()" >/dev/null'
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
0.12 real 0.04 user 0.05 sys
0.13 real 0.04 user 0.05 sys
real 0m1.384s
user 0m0.435s
sys 0m0.604s
Well, I would know if it were failing when using it, I'm using the tool every day after all :)
I reran the tests using hyperfine — and I get different results now. C version is around 16 times faster 🤔 But I remember it being slower in use!
I guess I really did have some issues with my installation or testing. I'll close the issue since I myself couldn't reproduce it 🤷♂️
Reproduction Rate
I could reproduce the issue every time I use tldr
Steps to Reproduce
brew install tldr
pip install tldr
tldr
s once, to update indicesrepeat 5 time tldr grep > /dev/null
Result
C version is about 5 times slower than the Python one
Expected Result
I expected, that the C version would be faster than the Python one, since C is a compiled language.
Additional Information
I am using macOS 10.15.7