Skip to content

Speed up rendering#165

Open
andreareina wants to merge 8 commits intoTrimps:masterfrom
andreareina:moar-faster
Open

Speed up rendering#165
andreareina wants to merge 8 commits intoTrimps:masterfrom
andreareina:moar-faster

Conversation

@andreareina
Copy link
Contributor

The changes pretty much either remove modifications to .innerHTML where HTML isn't needed (e.g. numbers that don't go to infinity) or batch said modifications so that HTML parsing happens only once.

One big source of jank I wasn't able to fix is in drawGrid(), where cell.innerHTML is assigned to.

Appending to .innerHTML in a loop causes a parse every loop iteration,
which is slow. Instead we accumulate the HTML strings and assign it to
.innerHTML in one go so that parsing just happens once.

This replaces the need for drawUpgrade(), so I've removed it as well.
Aggregating the style change is a minor speedup, most of the time is
spent assigning the cell's `.innerHTML`.
@andreareina
Copy link
Contributor Author

andreareina commented Sep 15, 2018

I think that's about as much as can be done with drawGrid().

@andreareina
Copy link
Contributor Author

andreareina commented Sep 16, 2018

Benchmarks!

trimps.github.io is the regular codebase of course, localhost is mine. # 1 is the liquid zones 1-21, # 2 is the overkilling over one full zone in the 2xx range.

image

OldNew
Liquid zones image image
Overkilling image image

@andreareina andreareina reopened this Sep 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant