buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
651 stars 45 forks source link

Rewrite terminal core in Go #11

Closed mipearson closed 9 years ago

mipearson commented 9 years ago

WFM!

Letting Ruby handle Emoji for now. This imparts an approximately 2x performance penalty on large sets .. but it's still miles ahead of the Ruby impl. Original acceptance tests have been ported from Ruby to Go, and I've added a couple of additional ones for correctness of multibyte handling.

Benches:

     npm.sh.raw ruby        0.8 (±0.0%) i/s -          4 in   5.183151s # original ruby
          npm.sh.raw        4.5 (±0.0%) i/s -         23 in   5.071450s # go via gem
    npm.sh.raw gocmd        9.0 (±0.0%) i/s -         46 in   5.092831s # go command run directly (no emoji)
     npm.sh.raw http       10.3 (±9.7%) i/s -         52 in   5.072454s # go via http (no emoji)
toolmantim commented 9 years ago

Ok, so Terminal 2.0.0 has been released, which no longer does the encoding or emoji munging. We're good to switch to using this super-powered Golang version. Now… do we just use this repo or start a fresh one for the golang version?

mipearson commented 9 years ago

Can you tell me why you dropped the encoding stuff and/or how you dropped it? Worried that I'll need to change my impl.

toolmantim commented 9 years ago

I've just put the onus onto the invoker to ensure they're passing in UTF-8. If you have your locale set incorrectly, then it'll bork. I don't think you need to do anything on the go side.

toolmantim commented 9 years ago

For context, if you pass in a wrongly-encoded UTF-8 string to the Ruby gem it throws an error in the regex gear. Not something you need to do I presume.

mipearson commented 9 years ago

New PR: https://github.com/buildkite/terminal/pull/14