Skip to content

Instantly share code, notes, and snippets.

@lemon24
Created July 4, 2018 22:45
Show Gist options
  • Save lemon24/9403e26ca36d4e9aa5b0fe0d73aff796 to your computer and use it in GitHub Desktop.
Save lemon24/9403e26ca36d4e9aa5b0fe0d73aff796 to your computer and use it in GitHub Desktop.
https://github.com/lemon24/reader/issues/77 (generate instead of render for the first 100kb)
### render()
$ python3 bench.py time
entries runs get_entries /?show=all ratio /?show=all#100kb
32 8 0.02 0.33 17.5 0.33
64 8 0.03 0.51 19.4 0.51
128 8 0.04 0.87 20.0 0.86
256 8 0.08 1.57 20.7 1.57
512 8 0.15 2.99 19.6 2.97
1024 4 0.17 3.00 17.9 2.98
2048 2 0.19 3.02 16.1 3.00
4096 1 0.24 3.05 12.9 3.04
$ /usr/bin/time -f 'real %e' curl http://localhost:8000/?show=all -s | grep 'class="entry"' -Fc
real 3.31
2507
$ /usr/bin/time -f 'real %e' curl http://localhost:8000/?show=all -s | head -c 100000 | grep 'class="entry"' -Fc
79
Command exited with non-zero status 23
real 3.23
### generate() / stream()
$ python3 bench.py time # generate()
entries runs get_entries /?show=all ratio /?show=all#100kb
32 8 0.02 0.35 20.7 0.35
64 8 0.03 0.53 20.3 0.53
128 8 0.04 0.90 22.0 0.90
256 8 0.08 1.64 21.3 0.94
512 8 0.15 3.11 20.5 1.02
1024 4 0.16 3.12 19.0 0.66
2048 2 0.19 3.13 16.5 0.48
4096 1 0.23 3.18 13.6 0.44
$ python3 bench.py time # stream(), enable_buffering(5)
entries runs get_entries /?show=all ratio /?show=all#100kb
32 8 0.02 0.34 22.1 0.34
64 8 0.03 0.53 20.3 0.52
128 8 0.04 0.89 20.1 0.89
256 8 0.08 1.62 21.3 0.95
512 8 0.15 3.10 20.2 1.02
1024 4 0.17 3.08 18.2 0.66
2048 2 0.19 3.10 16.3 0.49
4096 1 0.24 3.14 13.3 0.43
$ python3 bench.py time # stream(), enable_buffering(50)
entries runs get_entries /?show=all ratio /?show=all#100kb
32 8 0.02 0.34 20.7 0.34
64 8 0.03 0.52 20.1 0.52
128 8 0.04 0.89 21.4 0.89
256 8 0.08 1.65 21.5 0.94
512 8 0.15 3.06 20.4 1.03
1024 4 0.17 3.05 18.5 0.65
2048 2 0.19 3.08 16.4 0.48
4096 1 0.23 3.13 13.4 0.43
$ /usr/bin/time -f 'real %e' curl http://localhost:8000/?show=all -s | grep 'class="entry"' -Fc
real 3.46
2507
$ /usr/bin/time -f 'real %e' curl http://localhost:8000/?show=all -s | head -c 100000 | grep 'class="entry"' -Fc
79
Command exited with non-zero status 23
real 0.70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment