Technical Details on Slow Thread With Many Embedded SGFs

Is something wrong? Do you have any suggestions? Let us know.
Post Reply
hyperpape
Tengen
Posts: 4382
Joined: Thu May 06, 2010 3:24 pm
Rank: AGA 3k
GD Posts: 65
OGS: Hyperpape 4k
Location: Caldas da Rainha, Portugal
Has thanked: 499 times
Been thanked: 727 times

Technical Details on Slow Thread With Many Embedded SGFs

Post by hyperpape »

We have a thread that takes an extremely long time to render: viewtopic.php?f=13&t=17570. It has dozens of SGFs, and takes around a minute to fully render on my 2015 MacBook (though I might have some background stuff or other things that inflate that number). I thought I'd make a thread to record any technical discussion and not pollute the main thread.

I thought using
tags might work. Tryss said he thought the number of variations was driving the slowness.

I did the laziest "investigation" possible, and opened the page with Chrome performance tools. I saw repeated cycles of long running tasks, with the biggest time driven by layout and paint. To me, that makes me curious if we're having an O(n^2) problem where each SGF triggers a new layout and paint for the entire document. Hopefully hide tags might either avoid the repeated layouts, or make them faster? Honestly, I'm not that familiar with the DOM mechanics here.

I assume we don't have an appetite for patching Eidogo to avoid the repeated layouts.
hyperpape
Tengen
Posts: 4382
Joined: Thu May 06, 2010 3:24 pm
Rank: AGA 3k
GD Posts: 65
OGS: Hyperpape 4k
Location: Caldas da Rainha, Portugal
Has thanked: 499 times
Been thanked: 727 times

Re: Technical Details on Slow Thread With Many Embedded SGFs

Post by hyperpape »

Looks like the eidogo iframe is added to the page using document.write. I wonder if we could do a hack, and leave the document.write calls there, but write a dummy element, then attach an event handler for DomContentLoaded and then replace the element with the iframe. (Note: DomContentLoaded is available in IE9 and up, so we'd be losing eidogo support for IE 7 & 8, but do we care?).

The other question is whether making some of the eidogo scripts async would be helpful at all. It would presumably make the posts show up earlier, but it's not clear to me whether it would make the overall time to render any better.
Ferran
Lives in gote
Posts: 664
Joined: Mon Apr 22, 2019 1:04 am
Rank: OGS ddk
GD Posts: 0
KGS: Ferran
IGS: Ferran
OGS: Ferran
Has thanked: 177 times
Been thanked: 121 times

Re: Technical Details on Slow Thread With Many Embedded SGFs

Post by Ferran »

IME, It starts slowing down on REload, but does the first render decently.

I tried using hide on the first league, IIRC, but something wouldn't let me. Can't recall what. Time permitting, I'll try to substitute the files with the trimmed games and link to the game page on OGS. Right now, however, I'm not even following the game. They're on move 150+ of today's first game, but I have something else that IRQs me.

Take care
一碁一会
Post Reply