Zola: Improve performance

Created on 31 May 2017  Â·  10Comments  Â·  Source: getzola/zola

Integration tests are very annoying to write/change and benching could use some scripts to generate some big (.gitignored) websites and then have benchmarks on it

I don't really have any idea for the testing part so any help is welcome

Feedback wanted help wanted

Most helpful comment

All 10 comments

The flaky issue is with the categories integration test:

thread 'can_build_site_with_categories' panicked at 'assertion failed: `(left == right)` (left: `1`, right: `2`)', tests/site.rs:200

Edit: this is fixed

So for the benches I envision a script generating various (gitignored) scenarios:

  • blog: 1 section with 250 pages with tags & categories
  • huge blog: 1 section with 10000 pages (https://discourse.gohugo.io/t/smashing-magazine-s-redesign-powered-by-hugo-jamstack/5826/9) with tags & categories
  • ~10 sections with ~100 pages each
  • ~10 sections with ~1000 pages each

Both blog scenarios should have one bench each for syntax highlighting turned on/off
I think anything smaller would not really make sense to benchmark.

cc @williamyaoh I'll write the script today or tomorrow if possible so we have a baseline to compare with

Script added in https://github.com/Keats/gutenberg/pull/88/commits/cfcc4e7c3878b94344bd0e63cbc24e2074e615e0 and I think we have a case of https://accidentallyquadratic.tumblr.com/ :D

It's super slow even for 250 articles. I'll dig into that tomorrow or later this week. The slowness is not from the loading which happens pretty fast (130ms for 300 pages) but the Site::build.
I'm wondering if I'm not going too crazy with the nested serialization with paginations etc

For the "fast" part, the loading:

2017-06-21-145401_921x485_scrot

Note that 1000 pages 'only' take 1.7s to read and render markdown without syntax highlighting so it's not TOO bad but can obviously be made non n^2

I've pushed the loading benchmarks on the next branch, next is make it fast

So for the loading, the last (obvious) hanging fruit afaik is that loop: https://github.com/Keats/gutenberg/blob/master/src/site.rs#L98

If i hack together a par_iter that does roughly the same, it's around 50% faster. The issue is that I have no clue how to modify self in the parallel iterator or if it's even doable. Too late to investifate more.

Correct me if I'm wrong, but it seems like reading the file contents from
disk is the bottleneck that needs to be threaded, right? In that case,
couldn't you simply create the Page and Section objects in parallel,
but change add_page and add_section to accept an owned, already-loaded
object and still call those in series?

I should have updated it but that's how i changed it this morning. I'll
push the changes when I get home.

On 22 Jun 2017 9:35 am, "William Yao" notifications@github.com wrote:

Correct me if I'm wrong, but it seems like reading the file contents from
disk is the bottleneck that needs to be threaded, right? In that case,
couldn't you simply create the Page and Section objects in parallel,
but change add_page and add_section to accept an owned, already-loaded
object and still call those in series?

On Jun 21, 2017 10:24, "Vincent Prouillet" notifications@github.com
wrote:

So for the loading, the last (obvious) hanging fruit afaik is that loop:
https://github.com/Keats/gutenberg/blob/master/src/site.rs#L98

If i hack together a par_iter that does roughly the same, it's around 50%
faster. The issue is that I have no clue how to modify self in the
parallel iterator or if it's even doable. Too late to investifate more.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Keats/gutenberg/issues/78#issuecomment-310114445,
or mute
the thread
aUgvYgBtcly96pfWofks5sGTW9gaJpZM4NrizQ>
.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Keats/gutenberg/issues/78#issuecomment-310242729, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AApho9xPqd-h56jtE8ZUONM2-Md0UZsyks5sGbbsgaJpZM4NrizQ
.

Pushed https://github.com/Keats/gutenberg/pull/88/commits/b158ca79528928ab5ca176888686d3b078a7ad1c

 name                                                current.bench ns/iter  now.bench ns/iter  diff ns/iter   diff %  speedup 
 bench_loading_big_blog                              164,714,894            129,928,686         -34,786,208  -21.12%   x 1.27 
 bench_loading_big_blog_with_syntax_highlighting     644,116,974            541,249,158        -102,867,816  -15.97%   x 1.19 
 bench_loading_medium_blog                           41,935,664             31,289,882          -10,645,782  -25.39%   x 1.34 
 bench_loading_medium_blog_with_syntax_highlighting  159,659,632            149,630,526         -10,029,106   -6.28%   x 1.07 
 bench_loading_medium_kb                             168,637,495            131,690,163         -36,947,332  -21.91%   x 1.28 
 bench_loading_medium_kb_with_syntax_highlighting    638,500,862            575,134,100         -63,366,762   -9.92%   x 1.11 
 bench_loading_small_blog                            4,625,168              3,454,008            -1,171,160  -25.32%   x 1.34 
 bench_loading_small_blog_with_syntax_highlighting   18,526,481             16,519,896           -2,006,585  -10.83%   x 1.12 
 bench_loading_small_kb                              15,476,227             11,794,476           -3,681,751  -23.79%   x 1.31 
 bench_loading_small_kb_with_syntax_highlighting     62,483,195             55,922,676           -6,560,519  -10.50%   x 1.12
Was this page helpful?
0 / 5 - 0 ratings

Related issues

snsvrno picture snsvrno  Â·  4Comments

sternj picture sternj  Â·  6Comments

phil-opp picture phil-opp  Â·  3Comments

svenstaro picture svenstaro  Â·  5Comments

porglezomp picture porglezomp  Â·  7Comments