Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply all the recent performance improvements #381

Merged
merged 2 commits into from
Jun 14, 2020

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Jun 14, 2020

This updates livesplit-core which brings a variety of performance improvements:

  • The Layout State is now being reused and thus most frames don't require any heap allocations anymore. However we still serialize everything over into a JSON string for now, which puts a lot of
    garbage on the JS heap.
    Implement updating the Layout States livesplit-core#334

  • The frequent performance.now() calls we do, first look up the window and performance object every time. This tripled the amount of calls we do over into JavaScript, with each call into JavaScript being quite expensive in Chrome.
    Reduce overhead of JavaScript calls livesplit-core#335

  • By introducing a timer snapshot mechanism we further reduce the calls to performance.now() to a single time.
    Introduce a Timer Snapshot Mechanism livesplit-core#339

  • Rust 1.44 regressed the performance of 128-bit integer multiplications by accident. Those are used for hashing the comparisons when looking up the times for a comparison, which is something we do very frequently. We however don't have many comparisons, so a simple Vec that we loop through is a bit faster, even in native code, and quite a bit faster in the web, because of the Rust 1.44 regression.
    Speed up the comparison time lookups livesplit-core#338

  • We delay registering the Gamepad Hook Interval until the first gamepad button is registered. Most people won't use a gamepad, so the interval just wastes cpu time for no reason.
    Delay registering the Gamepad Hook livesplit-core#340

This updates livesplit-core which brings a variety of performance
improvements:

- The Layout State is now being reused and thus most frames don't
  require any heap allocations anymore. However we still serialize
  everything over into a JSON string for now, which puts a lot of
  garbage on the JS heap.
  LiveSplit/livesplit-core#334

- The frequent performance.now() calls we do, first lookup up the window
  and performance object every time. This tripled the amount of calls we
  do over into JavaScript, with each call into JavaScript being quite
  expensive in Chrome.
  LiveSplit/livesplit-core#335

- By introducing a timer snapshot mechanism we further reduce the calls
  to performance.now() to a single time.
  LiveSplit/livesplit-core#339

- Rust 1.44 regressed the performance of 128-bit integer multiplications
  by accident. Those are used for hashing the comparisons when looking
  up the times for a comparison, which is something we do very
  frequently. We however don't have many comparisons, so a simple Vec
  that we loop through is a bit faster, even in native code, and quite a
  bit faster in the web, because of the Rust 1.44 regression.
  LiveSplit/livesplit-core#338

- We delay registering the Gamepad Hook Interval until the first gamepad
  button is registered. Most people won't use a gamepad, so the interval
  just waits cpu time for no reason.
  LiveSplit/livesplit-core#340
@CryZe CryZe added enhancement A new feature or general improvement to LiveSplit One. performance Performance is suboptimal and should be improved. high priority This is a high priority issue. labels Jun 14, 2020
@CryZe CryZe requested a review from wooferzfg June 14, 2020 13:37
Copy link
Member

@wooferzfg wooferzfg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't run into any issues while testing, so this looks good.

@CryZe CryZe merged commit 4a1379c into LiveSplit:master Jun 14, 2020
@CryZe CryZe deleted the all-the-perf-boosts branch June 14, 2020 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or general improvement to LiveSplit One. high priority This is a high priority issue. performance Performance is suboptimal and should be improved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants