prismarine-viewer icon indicating copy to clipboard operation
prismarine-viewer copied to clipboard

Remove work from the main thread

Open 3top1a opened this issue 3 years ago • 3 comments

I've been looking at the Lighthouse report for my viewer on 2b2t spawn (local, downloaded file), and the performance was terrible. Some of my findings after messing with the code:

  • Making all event listeners (controls.js) passive reduces input lag
  • AO is slower (models.js:202)
  • Basic material is faster (entity.js:174, worldrenderer.js:16)
  • With the rendering faster, the map also loaded faster

The last one is the most important one and the reason why some parts (rendering, io, etc) should be in another thread.

Here's an implementation example from a blog

Here's a test of time to load all chunks in 6 render distance. 1.15.1: 1m 51s My optimized version: 0m 28s

All done on a paper 1.12 server, on this world

3top1a avatar Mar 07 '21 19:03 3top1a

do you plan to PR your optimized version?

rom1504 avatar Mar 07 '21 21:03 rom1504

When the reuse viewer pr gets merged, im going to add a simple renderer option

3top1a avatar Mar 07 '21 23:03 3top1a

Also, the "optmised" version is just the findings applied

3top1a avatar Mar 07 '21 23:03 3top1a