Terminal.js

Lightweight Screen Buffer

  • 所有者: mbebenita/Terminal.js
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Terminal.js

Sadly, there is no conveneint way to perform low overhead text tracing in modern web browsers.
If you are doing printf debugging and have to deal with lots of text data your options are limited:

  1. Use the browser's developer tools console.
  • Opening the developer tools often slows down your application, which is very annoying if you're trying to understand performance problems.
  • Consoles have a ton of features but can't do very simple things well, like handle lots of text. If you write a lot of text to the console, you'll hang the browser.
  1. Write text to the DOM.
  • You can build your own console using HTML elements. This is only slightly better than using the developer tools.
    You're still allocating tons of memory and possibly causing page reflows if you're not careful.
  1. Write your own text view using Canvas 2D.
  • This works fairly well. You can manage your own string buffer and draw a portion of it with Canvas2D text commands.
    The only drawback here is that you have to keep around a bunch of strings in the JS heap, creating memory pressure.
    You can optimize things by only decoding strings when they are needed but then you allocate lots of new strings, which is not idea.
    I spent a lot of time optimizing this, but at the end of the day it's still not cheap.
  1. Pipe the console output to stdout. You can do this in Firefox and Chrome using some perfs and command line arguments. This is a good idea, do this if you can.

  2. Use this library.

  • Text is encoded as a Uint8Array and uploaded to the GPU as a texture where it's then drawn by a fragment shader.
  • Aside from managing the memory of the text buffer, no allocations happen during tracing and rendering.

Demo:

http://mbebenita.github.io/Terminal.js/

主要指標

概覽
名稱與所有者mbebenita/Terminal.js
主編程語言TypeScript
編程語言Makefile (語言數: 3)
平台
許可證
所有者活动
創建於2015-01-05 05:33:18
推送於2015-09-12 18:15:07
最后一次提交2015-09-03 16:01:43
發布數0
用户参与
星數26
關注者數5
派生數0
提交數6
已啟用問題?
問題數0
打開的問題數0
拉請求數0
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?