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

UI Performance Issues #10

Open
2 of 4 tasks
jhnsnc opened this issue Nov 7, 2015 · 1 comment
Open
2 of 4 tasks

UI Performance Issues #10

jhnsnc opened this issue Nov 7, 2015 · 1 comment

Comments

@jhnsnc
Copy link
Contributor

jhnsnc commented Nov 7, 2015

(FYI: I'm currently working on a PR for this)

I've taken a closer look at the UI code and I have some ideas on how to improve performance. Here are some of the things I'm considering addressing:

  • using setInterval for regular updates instead of the more efficient requestAnimationFrame
  • querying the DOM every time an element is mutated instead of caching DOM references
  • using jQuery's replaceWith to overwrite element markup rather than mutating the existing element
  • scrolling patterns by modifying scrollTop rather than using CSS transforms (scroll seems to cause unnecessary repaints)

Note that I don't have a precise way of measuring the mod player's performance. My current method is measuring general JS performance with Chrome dev tools (though that's not a direct indicator of perceived WebAudio performance). I also have several mods that play very slowly (with a lot of hitching) and so hopefully those will play back smoother as UI performance improves.

@jhnsnc jhnsnc changed the title UI Performance Enhancements UI Performance Issues Nov 7, 2015
@electronoora
Copy link
Owner

Sounds good. The scrolling pattern visualisation seems to be - at least on iOS Safari - the most CPU intensive part of the UI. Especially when switching over from one pattern to another, the change in visibility within the DOM seems to incur a serious performance hit.

I'm assuming a part of the problem is the fact that a single pattern consists of a huge number of span -elements. Using spans more sparingly and applying them only where colour other than the baseline gray is needed had a visible effect on performance. Still, busy multichannel modules are still quite heavy on the CPU. I don't know if there are better ways to emulate text mode character attributes without bloating up the DOM too much.

Using jQuery id selectors wherever applicable instead of class selectors seems to also improve performance significantly.

Regarding stuttering audio, the XM player code seems to be especially bad in some modules. I'm suspecting that this may not be UI-related, but instead an issue with bugs in the volume ramping and/or interpolation code - namely, some FP operations returning NaN or Inf. I'm assuming this is due to overhead from handling SIMD FP exceptions from the CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants