Unanswered user makes question their MS thesis and answers self 2 years later
stackoverflow.com
stackoverflow.com
Now that he knows for a fact that GUIs can be fast, he'll be suffering for the rest of his life when a GUI app is slow for any reason.
I'm only 50% joking here.
Not only slow GUIs but GUIs that demand tens or hundreds of MBs just to draw a few items
If you were on my software project, and you weren't using native controls on macOS or Windows, one of the big two on Linux, or Electron, you'd better have a damn good reason.
Video games count as a damn good reason.
The point of the comment asking about Qt is most likely that Qt is not heavyweight (it does a great job even on embedded.), therefore pointing out that there is a difference between Qt and the other you mentioned.
I'm not a fan of OOP and I think there are more interesting framework model - but Qt is definitely the best and most efficient GUI framework I've had the pleasure to work with.
> The LCL should automatically provide accessibility for all of its standard controls, or allow the underlying widgetset to provide its own accessibility for the controls utilized directly from the widgetset.
GUIs don't need to be heavyweight to be accessible or internationalized (excepting for text translations, which should be downloaded rather than installed)
I don't know much about GUIs but lightweight tools often fail to take accessibility into account, and hand-rolled tools almost always do.
(Consider the Rick and Morty "true level" bit... and realize it's not that much of an exaggeration when it comes to stuff like this...)
For others interested: https://www.youtube.com/watch?v=Q1zBtJhgwBI
I have worked with people actually trying to do several of such projects like implementing RSA encryption from scratch, a charting library, and several other similar projects they assumed where going to be a quick solution. It’s not that such projects are impossible, it’s that people starting them generally have no idea what’s actually involved.
That said, if you’re doing it for fun then feel free.
(I suspect RMS probably suspected the timeframe for GNU, at least for the collection of system utilities rather than the kernel, was going to be a multi decade piece of work.)
No one can predict the longevity of a project, but that’s not the point.
So, this is the perfect example of what I am talking about. Getting something you can generously call a charting library isn’t that hard, getting something worth the time building on it’s own merits is. If you want to have a fun side project go for it. However, if the goal is to actually make charts it’s extremely unlikely that starting from scratch is a good idea.
And yet I still had a dev get pissed off by my offer to help with a charting problem. "Yeah, but was it D3?"
I'm generally an advocate for buy-before-build in software, but I don't trust the kind of dev who won't even acknowledge that the easy part of a problem is easy (or that true experience isn't framework specific).
A couple of months ago, a junior developer mentioned he'd need a library for a bar chart, and asked for directions how to use it in an Xcode project. It turned out to be easier to draw the chart with a few rectangles, and the developer had one of those great a-ha moments.
Other than that, failure is how we learn, and maybe you will succeed.
(if you recognise the reference you're right if not it's here https://www.youtube.com/watch?v=jG7dSXcfVqE)
> I am currently working on a standard Windows desktop application <...>
> and have decided to write a GUI framework on my own
If you want to write an application, rolling your own GUI framework is obviously a horrible idea.
In this particular case the reddit!OP converted their GUI framework experiment into a master thesis, but that does not make the advice in the 'first comment' less valid. Did they write that application they wanted?
In practice, I think this is not correct. You will almost always be told that your question is a bad idea and you need something different (even if you already know it is a bad fit and you've said so...). I've had to make peace with the fact that it's probably a cultural thing to feel like the questioner is in fact mentally handicapped in some profound way.
Also I wouldn’t call QT ‘misery’. Drudgery maybe?
The executor could run all of the rendering closures on one core and benefit from caching.
It could detect slow rendering closures and automatically switch them to buffered mode and run them on a "slow renderers" thread. This would keep the rest of the UI snappy. It could also tint those portions of the UI so users can see which app is the culprit of UI slowness.
I hope that Rust can someday be used as the basis of an OS that does not rely on sandboxing for security, but instead uses the compiler to enforce security. Such an OS could use cooperative multitasking and use a lot less energy and less expensive hardware than our current multi-core CPU + MMU + kernel ring model.
I now have some production experience in Rust and have learned to shy away from Piston. I think you've inspired me to try again with SDL2 and a better approach.
To prevent software modification, we need a new CPU with two memory controllers, one for data and one for code. The code memory controller can only read, not write. A separate CPU runs the compiler and writes the code RAM.
Admittedly, all I know about immediate mode and retained modes GUIs, I learned from this post, but I wonder why there’s no library that uses both. Could a library: 1. Use immediate mode to calculate the display. 2. Use retained mode as long as the amount of change is below a certain threshold. 3. Switch to immediate mode above the threshold. And so on.
If you have some UI in retained mode, chances are that rendering it live every frame will lead to unacceptable performance.
But if you have UI in immediate mode, you can probably switch to retained - essentially lazy rendering until something else happens. But you'll have to be very careful that your render calls are indeed pure functions, and cannot produce different outputs unless some input has indeed changed.
Sciter (https://sciter.com) uses both, as internally as on user's level.
For example you may want to define this:
var bodyElement = document.body;
bodyElement.paintForeground = function(graphics) {
... draw something
... on top of <body> content
... using the graphics
}
This allows to benefit from both: retained mode (HTML DOM, layout cached) and immediate mode rendering - paint handlers on DOM elements.It's a complex tangle, all in all.
Are you building vertex buffers? Are you creating backing layers? These are the critical details, not whether or not the API itself “looks” like an immediate mode or retained mode API.
Even the immediate mode APIs retain information!
As soon as you do compositor work, you need framebuffers, and you can kiss perf goodbye as you realize you can’t just destroy panels left and right without some abstraction to efficiently use video memory.
Oh, you can’t paint then scale later? Oh, so to do transparency effects you have to redraw the primitives every frame with new alphas instead of sending a different alpha to your shader? OK. Sure.
What’s your invalidation strategy? You don’t have one because it’s all “immediate,” sure. That’s really interesting. If there’s no performance difference, then well, hmm, why didn’t we do this back in the win32 era?
Oh well, of course, it’s because there is a performance difference. And it’s staggering.
The most critically important work I’ve seen in modern GUI architecture has nothing to do with the API itself and everything to do with the compositor. You can make the API almost always look like anything you want. Under the hood, it’s frametime life or death depending on how you rasterize and display large amounts of UI and typesetting, and panel layout.
>Are you building vertex buffers?
yes
>Are you creating backing layers?
I am not sure what those are.
>Even the immediate mode APIs retain information!
Yes, immediate mode only refers to the way the API is designed, it has nothing to do with how the framework works internally.
>Oh, you can’t paint then scale later? Oh, so to do transparency effects you have to redraw the primitives every frame with new alphas instead of sending a different alpha to your shader? OK. Sure.
Yes, in my implementation, I redraw every primitive every frame.
>What’s your invalidation strategy? You don’t have one because it’s all “immediate,” sure. That’s really interesting. If there’s no performance difference, then well, hmm, why didn’t we do this back in the win32 era?
Because the graphics hardware wasn't there. Todays GPUs are crazy fast, which enables you to just push tens of thousands of vertices to the GPU and be done in less than a millisecond. In the early days this all had to happen on the CPU, which were way too slow for this, so you had to be very careful about what to redraw.
As far as I am concerned though, it is pretty irrelevant to the user if an application is slow because the developer made a mistake, or because they wanted it that way.
In most retained-mode GUIs, this meta-state is often a copy of a significant portion of your application state, but with a very different structure. To maintain the integrity of both copies, you then need a layer of events and/or listeners on top of that, with a complex and dynamic control flow.
Retained mode optimizes for display throughput, which matters a few decades ago. Immediate mode is better for latency and consistency, which are much more important now.
React's reconciliation bridges this - immediate mode programming model, retained mode commit model, with key-based bailout to solve the O(n^3) problem. There are reasonable disagreements as to how necessary this is, of course.
Games also tend to be the only/main thing running at a time and constantly update large parts of their display. This is not true for most applications.
If you have transparent or moving elements you have to identify the components behind them and redraw those as well. You could use buffers for each element to avoid some of it, but then you may have to update several buffers for various changes.
If you have elements that are updated a thousand times per frame (progress bars) do you update the whole element every time, only update the affected region of it on every change or try to somehow collect changes that might affect different parts of it for a single update operation?
How often you repaint or have to relayout should depend on only two things. How often is your data changing? And how soon does the user need to see that new data?
Even things like moving the mouse or view are just data changes. (In fact, the biggest messes you'll get into when writing GUI and render code is when you've failed to incorporate something into your scene or data model and end up handling it with a lot of special case code.)
If you look at ALL the digital workstations, they're doing their own rendering. And they all punt on text scaling.
Maybe start with X and explain what's so bad about that. Athena is pretty damn bare bones. Fast forward 40 years, what about embedded Qt? It's small and fast. What's the problem with it?
I'd be curious to know his complaints and how he addressed them.
Usually the GUI framwork wants to own the project. I need to build an application IN Qt or IN C# with WPF. Thats just unnecessary. There is no reason why these libraries can't just provide a header with some functions that I can call, and thats it. The notion that I have to use C# for WPF seems completely ridiculous to me. Or that I don't get to use my own build system (Qt) or chose how I want my control flow to happen and so on. I want the GUI framework to be a library to my application, no the other way around.
I hate all of these build shenanigans. I had a C++ application, that I built with a .bat file. I was not gonna port that to C# or have some bullshit wrapper around C#, or port the whole thing to Qt, or switch my build system. That WPF and Qt required this of me is just unnecessary, and I was super annoyed that everybody thinks that is just ok and not a big deal. Stuff like this makes modern programming a slog and kills my productivity and morale.
I don't know about embedded Qt, but after seing that standard dev Qt download is 40 GB, I already knew this is not going to work because 99% of that is going to be stuff I don't need or want, and (as it always goes with these things) it is going to cause a lot of friction, because, of course, I will still have to interact with those things.
So, yeah, basically I just couldn't find a small, simple, non-intrusive, no arbitrary constraints GUI library that looked halfway decent.
The best I could manage was looking for an error message when I had a problem with mp3 id3 tags handling, finding an unanswered, 4 years old question on SO which was exactly my problem and eventually answering it after solving it myself.
But given the constraints of the "talking to the underlying DOM" part it's going to be a bit handwavey no matter how you argue it, I suspect.
This is what's happening when the browser redraws when you scroll for example. Arguably it has to do with the DOM, but certainly not how the DOM gets updated.
"blitmediate"
https://hacks.mozilla.org/2017/10/the-whole-web-at-maximum-f...
I tend to use the built-in framework (Swift native API). WFM.