News for hackers. Stuff that matters.
Re:Why modern software is slow by musicale on Thursday September 29, 2022 @09:36PM (#33029800)
> You have to be spectacularly bad at programming to make something so basic so slow in 2022 on a very high-end gaming computer.

I don't understand why desktop app user interfaces aren't blazingly fast and 240fps.

That being said, I think current iOS and macOS can run their UIs at 120fps (and Apple devices still seem to have decent battery life.)

Re:Why modern software is slow by WalterBright on Friday September 30, 2022 @12:00AM (#33030757)
> I don't understand why desktop app user interfaces aren't blazingly fast and 240fps.

Telemetry back to HQ takes resources.

I began to notice my disk drive light flickering regularly even when I was doing nothing with the computer, and the computer started seeming sluggish. I'd look at the process list, and started randomly forcing them to quit. Suddenly, the drive light stopped flashing. I'd found my man.

Googling the name of the process, it belonged to a program I'd bought that served media files to my Roku box. But I wasn't asking it to stream anything at the time.

I didn't know what the hell it was doing, but couldn't justify it, and removed the program.

Re:Why modern software is slow by lelanthran on Friday September 30, 2022 @12:58AM (#33031163)
> Googling the name of the process, it belonged to a program I'd bought that served media files to my Roku box. But I wasn't asking it to stream anything at the time.

Maybe it was indexing.

Re:Why modern software is slow by WalterBright on Friday September 30, 2022 @02:52AM (#33031792)
It doesn't take days to index my hard disk. Besides, I configured it with the path the media files. There's no reason to spy on the rest of the drive.
Re:Why modern software is slow by _Algernon_ on Friday September 30, 2022 @02:59AM (#33031846)
Why would it be indexing if no files are changed?
Re:Why modern software is slow by duped on Thursday September 29, 2022 @09:57PM (#33029952)
GPU accelerated vector graphics rendering is an open problem.
Re:Why modern software is slow by raphlinus on Thursday September 29, 2022 @10:10PM (#33030052)
For now.

Unfortunately, even if you have very fast drawing, there are plenty of other ways to make software slow. But high performance GUI software is the main thing I'm working on at the moment and I expect to have interesting results in the coming months. If nothing else, it should be a data point of how fast GUI software can be.

Re:Why modern software is slow by danielvaughn on Thursday September 29, 2022 @10:18PM (#33030103)
I’m super excited to hear about this. I’ve been working on a programming language for UI designers, and I ran into some massive issues when I tried to build my own renderer. Gave up and now I’m just transpiling to other languages instead.
Re:Why modern software is slow by jahewson on Friday September 30, 2022 @12:28AM (#33030942)
Eagerly awaiting this!
Re:Why modern software is slow by jcelerier on Thursday September 29, 2022 @11:44PM (#33030658)
Maybe basic productivity applications shouldn't try to tackle open research problems and instead just do the thing which has worked fine for the last 30 years which is CPU rendering? Like, do you think notepad is going to burn your battery because it redraws 20x20 pixels on every mouse event ?
Re:Why modern software is slow by jiggawatts on Thursday September 29, 2022 @10:38PM (#33030218)
It isn’t an open problem for text editors or terminals, which is the point Casey made in his videos.
Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @10:45PM (#33030276)
text editors and terminals don’t render vector graphics though, do they? they rely on libraries to rasterize glyphs of a font into a bitmap once and use the bitmaps over and over.
Re:Why modern software is slow by _gabe_ on Thursday September 29, 2022 @10:56PM (#33030346)
> they rely on libraries to rasterize glyphs of a font into a bitmap once

Unfortunately it's not this simple. Unicode and multilingual support means you can't possibly generate a single bitmap to contain all possible characters. Modern UIs (including text editors and terminals) generally support various zoom levels, which requires re-rasterizing glyphs at different zoom levels. This means you typically have to rasterize vector graphics (your font) on the fly as needed and then update your bitmap.

Edit: Also, emojis and certain scripts require composting multiple glyphs together. This means you have to figure out which glyphs are required for your codepoint and use your font metrics to composite the glyphs appropriately. Then throw in mathematical notation and all bets are off.

My point is, rendering text is not a simple done deal, but it's also not an impossible feat and it can be done efficiently.

Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @11:11PM (#33030438)
that is a very pedantic argument. you completely overlooked the point i was trying to make.

vector graphics are not rendered directly to the screen. fonts are rasterized first, then the rasterization is what the GPU receives.

Re:Why modern software is slow by rileyphone on Friday September 30, 2022 @12:52AM (#33031126)
> that is a very pedantic argument. you completely overlooked the point i was trying to make.

lmao welcome to HN, if you don't enjoy that experience I don't recommend you try to argue here.

Re:Why modern software is slow by _gabe_ on Thursday September 29, 2022 @11:45PM (#33030661)
> vector graphics are not rendered directly to the screen.

What difference does it make if you're caching the rasterization or not? You're still rendering vector graphics. And you're not just rasterizing once.

Modern font renderers can't get away with rasterizing glyphs once and reusing them anymore than arbitrary vector graphics renderers can. I sure hope my vector graphics editors cache the rasterizations instead of re-rasterizing needlessly.

Re:Why modern software is slow by naikrovek on Friday September 30, 2022 @12:23AM (#33030908)
once, twice, two hundred times, whatever.

it's not every frame. that's my point. that you missed twice because you can't see past details to the point of the statement.

Re:Why modern software is slow by audidude on Thursday September 29, 2022 @11:18PM (#33030489)
a huge amount of emoji are embedded png in font files. newer ones, however, do require more work.

> figure out which glyphs are required for your codepoint and use your font metrics to composite the glyphs appropriately.

this is all done in shaping though, the renderers just see "put this thing there" and (at least in GTK) we just maintain texture atlases that are updated on the fly.

you're correct that it doesn't solve the same glyph at lots of scales though. but glyphy does (and at high FPS too).

Re:Why modern software is slow by kilburn on Friday September 30, 2022 @01:27AM (#33031324)
GTK's implementation of text rendering is is admittedly broken in several subtle ways that nobody seems to know how to properly fix. [1] Also, this is while _not_ supporting fractional scaling, which is something that users definitely want.

To be clear, I'm not bashing on GTK. I'm saying that it definitely isn't as simple as the above comment implies ;)

[1] https://gitlab.gnome.org/GNOME/gtk/-/issues/3787

Re:Why modern software is slow by audidude on Monday October 03, 2022 @11:30AM (#33068905)
That issue is literally why I have a branch integrating GLyphy. But yes, your casual drive by comment is definitely more knowledgeable than the people who work on the stuff.
Re:Why modern software is slow by audidude on Thursday September 29, 2022 @11:14PM (#33030461)
harfbuzz creator made https://github.com/behdad/glyphy/ which i integrated into GTK a while back (but we don't ship currently, because we still do the bitmap stuff).

the bitmap stuff still has major drawbacks though, like maintaining grid alignments and pixel boundaries where as this stuff (mostly) goes away using glyphy.

still work to be done around hinting though (hence not merged).

Re:Why modern software is slow by userbinator on Thursday September 29, 2022 @11:25PM (#33030525)
You shouldn't even need a GPU for basic UI like this, especially with "modern" ultra-minimalist flat UIs.
Re:Why modern software is slow by vladvasiliu on Friday September 30, 2022 @12:39AM (#33031024)
Yeah, but they're not actually completely flat since they're translucent.

Also, on Windows, the "acrylic" thing is a circus show. Every app behaves differently. It also manages to sometimes lag on an RX5600. I know it's an "old" gpu, but still...

Re:Why modern software is slow by rayiner on Thursday September 29, 2022 @11:01PM (#33030377)
But you don’t have to do it every frame. Most apps could just render to bitmaps once and cache the results.
Re:Why modern software is slow by moonchild on Friday September 30, 2022 @12:44AM (#33031051)
It is being worked on (ahem...)

But in most contexts, it is not necessary to render vector graphics 'live'; caching is acceptable, so this should not be a bottleneck for most desktop software.

Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @10:08PM (#33030026)
is it? MacOS has rendered the entire UI via PDF since OSX was first released.
Re:Why modern software is slow by astrange on Thursday September 29, 2022 @10:47PM (#33030293)
It's not really PDF, it just supports similar operations to PDF. There's more SVG UI elements now.
Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @11:21PM (#33030498)
but it’s vector graphics, right?
Re:Why modern software is slow by astrange on Friday September 30, 2022 @12:37PM (#33037089)
Only very recently. Like, all that old Aqua stuff wasn't vectors, it was done in Photoshop.

Bitmaps are much faster to draw and can be made pixel-precise up front. With vectors it's easy to have pixel cracks or blurry lines because it's offset .5px.

Re:Why modern software is slow by naikrovek on Friday September 30, 2022 @05:20PM (#33040946)
> Bitmaps are much faster to draw and can be made pixel-precise up front.

yes, but that alone doesn't require that bitmap graphics be used.

> With vectors it's easy to have pixel cracks or blurry lines because it's offset .5px.

only if your renderer or your artwork isn't done correctly; inkscape used to be notorious for floating point rounding errors showing up with very few manipulations of a shape.

it's also been very easy to very quickly rasterize vector graphics for some time. maybe not fast enough in the past I guess, but computers are certainly fast enough now.

I look forward to a time when UIs are just all vector all the time, and it's the monitor itself which rasterizes, thanks to a program that the attached device uploads as it boots up or as the monitor is connected.

it's going to get more and more difficult to continue increasing display resolutions and refresh rates over long inexpensive cables if we continue to rasterize on a computer and push raw pixels to the display device.

Re:Why modern software is slow by danielvaughn on Thursday September 29, 2022 @10:14PM (#33030077)
afaik there just hasn’t been a lot of work done towards leveraging the GPU for vector graphics. The one example I can think of is the Slug library.
Re:Why modern software is slow by ehvatum on Friday September 30, 2022 @12:25AM (#33030921)
> afaik there just hasn’t been a lot of work done towards leveraging the GPU for vector graphic

Sure there has been, in the form of the nvidia path rendering extension. https://developer.nvidia.com/nv-path-rendering

It works great, on nvidia cards. Adobe Illustrator on Windows makes good use of it. Calling the extension from C/C++ and Python is no big deal.

Re:Why modern software is slow by djbusby on Thursday September 29, 2022 @10:22PM (#33030128)
Like? SVG UIs everywhere? Could you make a UI that's like SVG and onclick handlers do the "magic". We could have a VB6 like SVG UI designer and program "actions" in $LANG?
Re:Why modern software is slow by ygra on Friday September 30, 2022 @01:06AM (#33031212)
WPF would probably be that. In any case, modern UI toolkits often are vector-based anyway because of UI scaling. Heck, even ancient ones are, if you look at the Marlett font. That contained scalable UI elements for Windows 95.
Re:Why modern software is slow by thefz on Friday September 30, 2022 @03:45AM (#33032133)
> That being said, I think current iOS and macOS can run their UIs at 120fps (and Apple devices still seem to have decent battery life.)

The same critique for Apple applies all the time, when you are completely vertically integrated and make your own chips up to the very software running on them, it's kinda easier.

That aside, there's no display offering above 60Hz IIRC in the Apple line. Correct me if I am wrong.

Re:Why modern software is slow by shadowfacts on Friday September 30, 2022 @09:01AM (#33034278)
The phone and laptop have had them since last year, the iPad Pro has had them for years and years now.
Re:Why modern software is slow by Kipters on Friday September 30, 2022 @03:57AM (#33032212)
14" and 16" MacBook Pros are equipped with 120 Hz displays
Re:Why modern software is slow by strulovich on Thursday September 29, 2022 @10:06PM (#33030021)
A lot of the speed games get is by having bad load times when starting up.

Keeping startup really fast and all interactions really fast is more challenging than it seems.

This is not the whole story, but one example of the differences in perception.

Re:Why modern software is slow by ehnto on Thursday September 29, 2022 @10:43PM (#33030260)
Streaming in hundreds of assets as you walk around an open world does surely take a different pipeline, but as a show of computing competence it is staggering. You should see how fast some of these truly massive games load nowadays. The fact that the notepad app takes forever to load when all it needs to load is the UI is just a sad state of affairs.
Re:Why modern software is slow by wtetzner on Thursday September 29, 2022 @10:10PM (#33030044)
But games are loading enormous textures, meshes, maps, etc. UIs don’t need any of that.
Re:Why modern software is slow by astrange on Thursday September 29, 2022 @10:45PM (#33030278)
A mesh may have a lot of triangles, but it's still a single object you can memory map. UIs are typically a bunch of heap allocations and pointer jumping all created at runtime. That can be surprisingly inefficient.
Re:Why modern software is slow by 8n4vidtmkvmk on Thursday September 29, 2022 @10:53PM (#33030328)
then make it efficient. overallocate a block of memory and use it for all your tiny ui elements. its exactly what games do.
Re:Why modern software is slow by astrange on Friday September 30, 2022 @02:42PM (#33038904)
Arena allocators only work when everything has the same lifetime.

There are game-like UI libraries (https://github.com/ocornut/imgui) but to use them you have to write your program like you're a gamedev and Conway's Law usually fights that.

Re:Why modern software is slow by thomastjeffery on Friday September 30, 2022 @12:23AM (#33030904)
Most bad loading times fall into 2 categories

1. Avoidable: The main one here is shader caching. Shaders could be precompiled for every supported card/driver, but that's more work than anyone is willing to do. Even so, some games (like Rust) have an excessive amount of shaders, which adds a lot of extra waiting time.

2. Unavoidable: The main one here is textures. If you want it to be quickly accessible in VRAM, then it's going to be uncompressed, which means either having some very large files to copy over, or having some semi-large files to decompress. You can save quite a bit of time by micromanaging the texture resolution of each asset to be just high enough. Apart from textures, you have vertex data and other assets; all of which have basically the same considerations.

When it comes to regular software, most UI designs don't have big assets. They aren't loading billions of triangles or thousands of textures. This means there really isn't much need for long startup times.