8 ms·
Ledit: Simple, GPU-rendered, no bullshit text editor
- ssivark 5y agoI understand this was an exploratory project, but from a practical perspective, how does this compare with one of the standard terminal-based editors, running in a GPU accelerated terminal emulator like alacritty/etc?
- KennyBlanken 5y agoPrograms that use the native OS's APIs are "GPU accelerated", too. "GPU accelerated" editors and terminal programs are snake-oil, just another spin on "minimalist" text editors. Instead, buy a high-refresh-rate monitor with good pixel response time and input latency. Probably 90% of the people reading this post are on a 60hz display, and many of those monitors may have noticeable input delay (Microsoft found that people can notice even just a few ms input/display delay.) Even just 75 hz or 100hz will feel noticeably nicer. There are a couple of pretty inexpensive ~95hz monitors aimed at office users, but 2.7k ~150hz gaming monitors aren't that expensive if you shop carefully. Even nice ones with IPS and good color gamut/calibration. Everything is nicer with higher refresh rates. Scrolling through web pages, file listings, editing text files, terminal sessions. Same is true of gaming mice; if you do a lot of mousework, a quality "gaming" wireless mouse is durable, has virtually zero input lag, great tracking, very accurate response to quick "flicks" letting you move windows and such around, and high polling rates. Default on most mice is around 120hz. Yes, you can tell the difference - though I have my mouse set to either 250hz or 500hz when not gaming, I forget which. Edit: just to note that someone pointed out keyboards matter, too, and they're right Some keyboards can have over 50ms input delay, which when you think about it, is fucking nuts in the year 2022. RTINGs tests for keyboard latency and their idea of "high latency" for a gaming keyboard can be 10ms. The difference between that and the fastest (1-2ms) keyboards is probably not worth selecting for over features like ergonomics and daily use factors.
- beardog 5y agoLikewise, keyboards can matter a bit too: https://danluu.com/keyboard-latency/ https://danluu.com/keyboard-latency/
- KennyBlanken 5y agoVery true. Some keyboards have latency twice as bad as the round-trip ping time of a server you might be connecting to half-way across the country, which is...nuts. There really isn't any reason for a keyboard to take half of a tenth of a second to register a keypress. RTINGs tests for latency, but I would caution folks to note that "high latency" to them is ~8 or 9ms, which as Dan's tests show, can be almost 10x better than some common keyboards out there.
- peakaboo 5y agoI see a huge difference using Kitty, it's much faster than other terminals.
- vidarh 5y agoKitty is decent, and I've used it a lot, but on my system at least rxvt-unicode beats Kitty's throughput by a factor of 2. If you've got a much faster gpu maybe your mileage may vary, but I can't even tell the performance difference unless I'm timing something like catting a large file to the terminal, which isn't something I do on purpose. Currently I'm using mlterm which is slower than Kitty again by a significant margin, and I still don't notice the difference in day to day use. (xterm, st and gnome-terminal are all slower than Kitty by huge margins; of the terminals on my system (I have a lot because I tested a bunch of them a while back...) there's a performance difference in terms of rendering throughput of at least a factor of 10, and yet even the slowest once are perfectly fine for most use other than the cat large file test)
- anthk 5y agoThis. Since XV days, X's 2D rendering has been accelerated by GPU's.
- deleted 5y ago[deleted]
- zaps 5y agoLanguage
- johnisgood 5y agoNot Rust, sorry.
- cosmotic 5y agoJust curious, why GPU rendered?
- ben-schaaf 5y agoCan't speak for this project, but you simply can't get good performance at high resolutions (4k+) using CPU rendering.
- sidpatil 5y agoI suppose "good performance" is subjective. I run VS Code on a 4k (well, 3840-by-2160) monitor attached to a ThinkPad T440, and the performance is acceptable. The CPU does get busier, but not by much. Though, the biggest limitation is that the framerate is only 30Hz since the HDMI version is older on that laptop, so maybe that has something to do with it as well.
- vidarh 5y agoYou could get good performance with CPU rendering on machines several orders of magnitude slower than what we had today to screens that certainly did not have as many orders of magnitude fewer pixels.
- pcwalton 5y agoIt's the right choice. Otherwise you're wasting power for no reason. The only reason not to use the GPU is driver bugs, usually on Linux, that cause it to use more energy than the CPU.
- oauea 5y ago> 3-4 byte unicode characters will not work That's a tad too simple
- mananaysiempre 5y ago(Notably 3-byte characters include all or almost all non-astral CJK, which is otherwise stupidly simple to draw.)
- vbphprubyjsgo 5y ago
- krona 5y agoThis is using FreeType to CPU render to a text atlas, to be clear.
- deathanatos 5y agoBut is this wrong? I think the current implementation might have some bugs, but why not create an atlas? Especially for code, most of the characters will be in ASCII, and if they're not, you can always push what isn't dynamically as needed. Most of the rendering still occurs GPU side. I suspect the post's code is also cheating on shaping, but even that seems like something you should be able to at least cache on the GPU? Like the 98% of cases, the GPU, and if for the 2% oddball stuff, the CPU needs to step in, so what? (Edit: perhaps I'm projecting the "wrong" part onto your comment; there's a lot of "why?" in these comments and the more I think about it, it honestly seems pretty sensible to push graphics to the *G*PU.)
- krona 5y agoI'm just commenting on the extent to which it is 'GPU-rendered', which in this case is apparently no more than a standard text rendering facilities provided by the OS. That's not to say it's not impressive considering how simple it is.
- dahart 5y agoIsn’t that how more or less all editors render text, on the GPU and on the CPU?
- Pulcinella 5y agoIt’s possible to perform the rendering of the font itself on the GPU (e.g. Pathfinder) instead of rendering an atlas on the CPU and sending it over to the GPU, but I’m not sure of any text editors that do so.
- dahart 5y agoOf course, it’s definitely possible. Just doesn’t seem like there are good reasons to spend time directly rendering the same font characters repeatedly, right? That’d be spending a lot of compute doing something you can pre-render and cache in a texture. ;) This is why a lot of CPU implementations render text atlases too.
- kazinator 5y agoBut editing is perfectly pleasant over a serial line. Even at speeds as slow as 9600 bps --- if the screen updates are optimized, like with curses. I'm editing a file on an embedded system in a PuTTY serial window (115.2 kbps). I'm in a remote desktop connection over a VPN to get to that PuTTY window. (1920x1200 resolution). Everything is responsive; no complaints. (I'm using BusyBox vi. OMG, it has poor optimization of refresh. I just switched to 9600 bps for fun and opened a small file in the editor. So most of the lines are filled with the tilde character, characteristic of Vi. When I type Ctrl-R to refresh the screen, BusyBox is repainting those ~ lines in their entirety. It's printing all the spaces! It has no knowledge of the "clear to end of line" or "clear from here to bottom of screen" escape sequences. It also scrolls the buffer by repainting, even single line scrolls when you move the cursor down from the bottom line or up from the top line. At 115200 bps, you don't notice any of this.)
- gumby 5y agoDoes emacs still have slow mode? I haven’t used it since the old TECO days but you could edit quite reasonably with a 150 baud line. Of course back then you could also use emacs on a printing terminal, which surely won’t work any more.
- lallysingh 5y agoWhy not? Text mode is still well supported
- gumby 5y agoSlow mode was designed to minimse (which included delaying) display updating. So you could type a bunch and only when you stopped typing would you see the display update to the final state -- intermediate states weren't rendered (so you could type ab<delete><delete>cd and only after you stoped typing would you see "cd" Printing terminal mode with similar in that it showed only the line you were on, and, IIRC, optionally the line above or below. This worked pretty well in Emacs where search is extremely lightweight and is (for most people at least) the primary cursor movement tool. Of course deletion couldn't display properly so you would get a marker on the screen (#?) to indicate, and then ^L would draw the then current copy of the line. You could write this support today, and perhaps someone has, but I wonder if it could possibly be worth it. This same reason is why the unix terminal driver by default starts up with # as the delete character command and @ deleted the whole line. That line discipline dates back to Multics, which had more efficient I/O as the Multics hardware had channel controllers (all our I/O is done with channel controllers these days, though we don't call them that). Actually, speaking of channel controllers: Emacs had a third mode: if you used the SUPDUP protocol (stood for super duper: roc 739, 746, 749) a bunch of the IO and screen update was done by your local host, not the remote machine on which you were running Emacs (or whatever). It implemented an abstract display and could even interpret a few commands to display the local buffer properly like a souped-up channel controller! This all predated Unix on the arpanet so later approaches went in a different direction. But remember this was back when you could have dozens of people using networked computers with clock speeds in the hundreds of kilohertz or less, back before the cross continent backbone was upgraded to ~56 Kbps.
- user3939382 5y agoThe prebuilt executable failed because it couldn’t dynamically load libpng and after I compiled it myself I got a seg fault.
- liz3_de 5y agocontact me or open a issue on gh if you wanna have help. Liz3#0001 yann@liz3.net
- beepbooptheory 5y agoI was ready to be critical and say that "bullshit" is relative, that the interface makes the user, etc., but then I saw the emacs-like navigation and now its hard to be too critical. Looks fine! Anyway, just curious: if I use vim in a GPU-rendered shell like kitty, is it pretty much the same as this in terms of GPU-related benefits? Or is this supposed to be better?
- imachine1980_ 5y agoIt sound like micro text editor take a look have incredible ux
- anthk 5y agoCairo, XCB and X extensions did hardware acceleration since 2D days (and now 3D with almost any backend API since Cairo). This is snake oil.