Life In 19x19
http://lifein19x19.com/

Technical Details on Slow Thread With Many Embedded SGFs
http://lifein19x19.com/viewtopic.php?f=14&t=17692
Page 1 of 1

Author:  hyperpape [ Sun Aug 02, 2020 8:40 am ]
Post subject:  Technical Details on Slow Thread With Many Embedded SGFs

We have a thread that takes an extremely long time to render: https://lifein19x19.com/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 [hide] 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.

Author:  hyperpape [ Sun Aug 02, 2020 9:43 am ]
Post subject:  Re: Technical Details on Slow Thread With Many Embedded SGFs

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.

Author:  Ferran [ Sun Aug 02, 2020 9:49 am ]
Post subject:  Re: Technical Details on Slow Thread With Many Embedded SGFs

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

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/