question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buttery smoothness 60fps performance issues

See original GitHub issue

Hello, I’m trying to make a roguelike game (like nethack) in full screen browser, with lots of animations and full screen effects in ASCII. That is 211x60 characters on my 1080p screen. Each one may be different and may have different color or other attributes every 16 milliseconds. Xtermjs is not handling my case very well. From my own little investigation I found out that the canvas rendering and parsing are the two biggest offenders.

Suggestions/Ideas

  • I was thinking maybe we could implement a webgl renderer to speed things up?
  • Not sure how parsing is handled but maybe we could cache more intensively there?
  • Make a canvas per line (or few lines) and let parsing/rendering for that chunk be done by web worker, make multiple of those webworker/few-lines combos to render entire terminal?

Details

  • Browser and browser version: Chrome 66
  • OS version: OSX 10.13
  • xterm.js version: 3.3.0
  • hardware: MacBook Air 2012 1,7GHz i5, 4GB DDR3

Steps to reproduce

const { columns, rows } = process.stdout
let counter = 0
let now = Date.now()
let then = now
function hm() {
  process.stdout.write('\x1b[H')
}
function cls() {
  process.stdout.write('\x1b[J')
}
function render() {
  process.nextTick(render)
  now = Date.now()
  const delta = now - then
  if (delta < 1000/60) {
    return false
  }
  counter = counter >= 9 ? 1 : ++counter
  let content = ''
  for (let i=0; i<columns*rows; i++) {
    content += String(counter)
  }
  hm()
  cls()
  process.stdout.write(content)
  hm()
  process.stdout.write(String(delta))
  then = now
}
process.nextTick(render)
hm()
cls()
  1. Create myperftest.js somewhere with above contents
  2. Run npm run start in xterm.js
  3. Increase number of rows and columns (I was testing on 250x50)
  4. Open the demo and run node myperftest.js
  5. Run chrome devtools performance

I am not sure what’s happening here. This test code above is generating a screen full of a single character (every character on the screen is the same). I know that Xtermjs implements character atlases so this test code should be running very fast? I need this to be 60fps. I also need each character on the screen to be different and the frame rate to keep the stable 60fps.

screen shot 2018-05-19 at 15 20 18 2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, May 20, 2018

Will try, lets see if I can come up with something. 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

I JUST WANT BUTTER SMOOTH 60FPS!!!!!!!!! - Linus Tech Tips
The GPU should be able to handle games at 60 fps with reasonable settings. The CPU performance and HDD load times could be...
Read more >
Doing THIS can make your PC games PERFECTLY SMOOTH ...
Use THIS for super SMOOTH PC games 25% discount code for software: PAN20Windows 10 Pro OEM ... Intro (What are the benefits of...
Read more >
Why do some games feel smooth at 60fps while other ... - Reddit
169 votes, 146 comments. For example if I run Sekiro in 60fps it feels butter smooth. If I run Halo Infinite at 60fps...
Read more >
Dishonored กระดานสนทนาทั่วไป - Steam Community
Dishonored pc runs at 60fps no problem. But it's not buttery smooth 60fps. Do this right now to make it buttery. ... BUTTERY...
Read more >
Why does 60 FPS look smoother in videos?
At 60 fps, that motion blur problem is largely eliminated, and 4K will look like it's supposed to look – extremely sharp and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found