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?
已存档?
是复刻?
已锁定?
是镜像?
是私有?