What does HackerNews think of refterm?

Reference monospace terminal renderer

Language: C

This reminds me of the kerfuffle Casey Muratori caused last year when he dared suggest the windows terminal could be faster.

https://twitter.com/cmuratori/status/1523024109831041024

https://github.com/cmuratori/refterm

Probably inspired by the performance problems with the windows terminal [1] and the accelerated terminal [2] developed by Molly Rocket as 'answer'? A series of videos presenting the poc [3]

[1] https://news.ycombinator.com/item?id=28743687 (It takes a PhD to develop that) [2] https://github.com/cmuratori/refterm [3] https://www.youtube.com/watch?v=hxM8QmyZXtg, https://www.youtube.com/watch?v=pgoetgxecw8

Quoting from the author of the blogpost:

"We actually took the same approach Casey suggested... A lot of terminals implement it that way." [1]

I guess authors of a lot of terminals are trolling you.

From the refterm README: "VT codes for setting colors and cursor positions, as well as strikethrough, underline, blink, reverse video, etc." [2]

And, to begin with, Windows Terminal was horrendously slow even without VT codes. Also, for context, [3]

[1] https://news.ycombinator.com/item?id=31285723

[2] https://github.com/cmuratori/refterm

[3] https://news.ycombinator.com/item?id=31285339

"Happens to be right" is kind of misleading here. It's not like he "happened" to call tails on a coin flip or something.

Microsoft has a history of writing unreasonably shitty software, abstracting it to all fuck with ten thousand layers of manufactured complexity, and then claiming the problem itself is hard. Casey was like, no, the problem is actually trivial, and if you just write code in a straightforward way without pessimizing your own code, you can easily get something 100x faster than Windows Terminal. He even wrote refterm to prove it: https://github.com/cmuratori/refterm

No one wants to be told that something they're working super hard on is actually trivial, and that all of their problems are basically self-created. There's no nice way to say that. It's basically saying, "stop doing 90% of the crap you're doing, and the problem solves itself." But it's true and it should be said.

Sure but in this case it was grossly over-estimated compared to the under-estimated side. Casey did the implementation [1] to prove the point and also made explanatory videos [2] of it.

[1] https://github.com/cmuratori/refterm [2] https://www.youtube.com/watch?v=hxM8QmyZXtg&t=1052s

>most of the code in the parser/renderer part of the terminal is unnecessary and just slows things down. What this code needs to do is extremely simple and it seems like it has been massively overcomplicated

He means exactly what he says. Notably, refterm had almost no optimization applied to it.[0] The massive performance increase was entirely due to non-pessimization.[1]

>refterm actually isn't very fast. Despite being several orders of magnitude faster than Windows Terminal, refterm is largely unoptimized and is much slower than it could be. It is nothing more than a straightforward implementation of a tile renderer, with a very simple cache to ensure that glyph generation only gets called when new glyphs are seen. It is all very, very simple. A more complex codebase that parsed Unicode and rendered glyphs itself would likely be much faster than refterm for many important metrics.[0]

[0] - https://github.com/cmuratori/refterm

[1] - Refterm Lecture Part 1 - Philosophies of Optimization - https://www.youtube.com/watch?v=pgoetgxecw8

They did, they implemented a crazy fast terminal renderer (that still supports advanced features like right-to-left languages in Unicode, etc.) from scratch in about 3,000 lines of code just to prove their point:

https://github.com/cmuratori/refterm

For a basic example of why you would want GPU acceleration, have a look at refterm: https://github.com/cmuratori/refterm

Even processes that you wouldn't think would be impacted by a terminal can be hurt relaly bad by your terminal's performance: your compiler's logs, etc. The GPU rendering part merely guarantees that your terminal sticks at 60FPS (or, whatever your refresh rate is) if the processing behind is efficient.

What is this about?

This refterm? https://github.com/cmuratori/refterm

Or a cats-in-space anime?

Or Handmade Hero?

It's here:

https://github.com/cmuratori/refterm

That issue was closed but the current open issue which acknowledges this is a real problem is here:

https://github.com/microsoft/terminal/issues/10462

Here is a comment on the code directly from a contributor at Microsoft:

> @AnuthaDev We‘re quite aware about the code and are extremely happy about what was created there. I mean it seriously: It sets a great goal for us to strive for. Unfortunately the code is intentionally GPLv2 licensed and we‘ll honor this wish entirely. As such no one at Microsoft will ever look at either of the links.

> I‘m the person who‘s tasked with building an equivalent solution and you may subscribe to #10461 to get updates of my progress. Unfortunately our existing project isn’t straight forward to modify the same way we could build a terminal from scratch. A lot of parts of this project must be rewritten and as such it‘ll take a bit for us to catch up. But we will - it’s only a matter of time.

https://github.com/microsoft/terminal/issues/10462#issuecomm...

I was curious as well, I dug a bit and I found this:

https://github.com/cmuratori/refterm

I think he just went ahead and created a completely different terminal.

Also, some background, the original raiser of the PR is Casey Muratori, of Handmade Hero fame:

https://www.youtube.com/channel/UCaTznQhurW5AaiYPbhEA-KA

https://github.com/cmuratori/

https://caseymuratori.com/

Reading the thread itself, it’s a bit of both. Windows Terminal is complex, ClearType is complex and Unicode rendering is complex. That said… https://github.com/cmuratori/refterm does exist, does not support ClearType, but does claim to fully support Unicode. Unfortunately, Microsoft can’t use the code because (a) it’s GPLv2 and (b) it sounds like the Windows Terminal project is indeed a bit more complicated than can be hacked on over a weekend and would need extensive refactoring to support the approach. So it sounds a bit more like a brownfield problem than simply ignoring half the things it needs to do, though it probably does that too.
This particular case was discussed at length on Reddit and on YC News. The general consensus was that the Microsoft developers simply didn't have performance in the vocabulary, and couldn't fathom it being a solvable problem despite having a trivial scenario on their hands with no complexity to it at all.

The "complaining developer" produced a proof of concept in just two weekends that notably had more features[1] and was more correct than the Windows Terminal!

RefTerm 2 vs Windows Terminal in action: https://www.youtube.com/watch?v=99dKzubvpKE

Refterm 2 source: https://github.com/cmuratori/refterm

One of the previous discussions: https://news.ycombinator.com/item?id=27775268

[1] Features relevant to the debate at any rate, which was that it is possible to write a high-performance terminal renderer that also correctly renders Unicode. He didn't implement a lot of non-rendering features, but those are beside the point.

I understand the scepticism about such claims, but Casey's renderer is not a toy, and handles a number of quite dificult test-cases correctly. He solicited feedback from a sizeable community to try and break his implementation. The code is vailable here: https://github.com/cmuratori/refterm
> Am I the only one who really enjoys Windows 11 so far?

Probably not, but consider that people have a lot of different use cases for their computer and a lot of different priorities and Microsoft has been pretty consistent lately about ignoring pretty much any of them that aren't "I really wish my desktop were a clunky tablet".

> I really like the new UI which feels more modern and harmonic

Subjective, but feeling more modern is precisely the opposite of what I want in a UI. Modern means slow and cumbersome with lots of wasted space, sparse options, and unreadable widgets.

> Control Panel is still in there somewhere but why should I care?

Control Panel had nothing wrong with it and probably still has settings options that are missing from the new ones?

> new GPU accelerated Terminal is really nice

It's performance is remarkably terrible for something that's GPU accelerated. Casey Muratori has said a lot about it. https://github.com/cmuratori/termbench and https://github.com/cmuratori/refterm were a result. It doesn't mean a lot in terms of quality of Windows 11, I just think it is a good illustration of modern Windows team's development practices.

> Does it have tons of telemetry, cruft from 20 years in the kernel and some rough edges?

Cruft is fine because it is there for backwards compat, which is huge for a tone of desktop use cases. Linux Kernel has a ton of cruft too for the same reason. Telemetry is bullshit and wastes my computer's resources to effectively spy on me.

> Is the hardware requirements a bit ridiculous?

The hardware requirements are very ridiculous. Windows 11 is not revolutionary, but somehow manages to require twice the minimum specs of ten in some metrics, and a TPM module.

> To each their own I guess but it sometimes feels a bit depressing how HN crowd trashes every OS.

They all have problems, big problems, so they all deserve it. I find it more remarkable that people consistently try to say that everything is actually ok!

> Is everyone here still using C64, Windows 2000 or OS9 because it „was the last good system“?

God I wish they were still viable.

> I don't get it either - I use Windows (the default cmd, Powershell and Cmder), Linux and MacOS and don't recall a terminal emulator being slow... ever.

You might be a particular type of person... I don't remember Windows Cmd being not slow, ever. It feels extremely sluggish. It supposedly has something to do with Windows ConHost, but I don't know about the details.

In fact, even most terminals on Linux are unbearable to me. Not only do the antialised vector fonts tire the eyes on sub-4K screens - most of the terminals I've tried feel slow as well, though not as slow as Windows Cmd.

http://danluu.com/term-latency/

https://github.com/cmuratori/refterm

Personally I use xterm with bitmap fonts whenever I can, it feels sooo good. It has both crisp font rendering as well as being reasonably fast/responsive. (It's probably not the fastest ever in throughput if you want to display /dev/urandom, but that's not my benchmark).

As luck would have it, here's the continuation to Windows Terminal. Casey Muratori made a reference terminal renderer: https://github.com/cmuratori/refterm

This uses all the constraints that the Windows terminal team cited as excuses: it uses Windows subsystems etc. One person, 3k lines of code, it runs 100x the speed of Windows terminal.

See the epic demo (and stay till the end for color output): https://www.youtube.com/watch?v=hxM8QmyZXtg