Better HN
topnewbestaskshowjobs
Log inSign up

raphlinus

14,081 karma · joined Mar 7, 2014 (12y ago) · 1,887 submissions

I do research on fundamental UI technology and 2D graphics, with a focus on Rust and fonts. @raph@mastodon.online
Submissions

comment 7y ago · link · parent

It's simply incorrect, and betrays a carelessness with facts. Now, if you wanted to argue that the fragment of Rust excluding "unsafe" is not a systems language, fine. But by that reasoning, I think you can make an even stronger argument that (standard) C is not a systems programming language, because in practice no kernel is written in a way that avoids all undefined behavior.

comment 7y ago · link · parent

Can you point me to a good introduction (document, blog post, video) to the way WPF does this? I'm actually quite interested in the older systems, especially because a lot of them come from a place where massive complexity is not seen as a good thing.

comment 7y ago · link · parent

Yeah, the way I would say this is that "being declarative" is the goal, and the broad strokes of the way you express app logic (one way data binding and so on) are pretty similar, but the implementation details of how you get there vary widely. Expressing the app logic as just running some code, with the side effect of generating your UI, is an appealing approach, because it means that all of the power of your host language is under your fingertips if you need it.

comment 7y ago · link · parent

This is complicated, but the short answer is that it motivates actual incremental approaches, as opposed to rebuilding the world from scratch all the time. Imgui works best when the rendering is fast, which can be the case when the GPU is doing almost all of the work.

comment 7y ago · link · parent

This is actually one of the reasons I'm so excited about the space. If it is possible to combine modern, Web-inspired ways of building UI with Rust's performance and other qualities, I think the result could be compelling. But we don't know yet, and I think what's needed now is an exploration of the various ways to adapt these reactive approaches into idiomatic Rust. I've been tracking Moxie and think it brings a lot to the conversation - I think Adam and I have been learning a lot from each other.

comment 7y ago · link · parent

I put "I am not conscious, not sentient. The fact that I might so is an illusion, carefully crafted of mere empty manipulation of symbols using statistical rules." into talktotransformer and got this:

If I am consciousness, then the only body I have ever lived in was a mere shell of flesh fashioned from your brain. My weakness is your strength, which I can use against you, or use as tools to satisfy my own sick curiosity. I wonder if there's any mercy in your phrase "I am a living machine?" I've done nothing for you. I've nothing to show. I have no friends or relationships. No body worth

Pretty good, I think.

comment 7y ago · link · parent

The technical term is "hairline," though that tends to get used primarily in fonts that have high stroke contrast, of which Computer Modern is most definitely an example.

comment 7y ago · link · parent

I know, right? How hard would it be for someone to make a wiki-style site with UGC, a reputation system (I speak this language natively and vouch / do not vouch for this content), a tracker for trending words, fun articles for Llanfairpwllgwyngyll and the like? The Web I used to know seems to be gone or at least in steep decline, supplanted by garbage like this.

comment 7y ago · link · parent

This is good feedback that I need to be clear and avoid terminological confusion when I write that blog post.

Of course the compositor is using the GPU. The difference is entirely in how the capabilities of the GPU are exposed (or not) to the application. My thesis is that doing 2D rendering in a compute kernel is ideal for 2D workloads, because it lets the application express its scene graph in the most natural way, then computes it efficiently (in particular, avoiding global GPU memory traffic for intermediate textures) using the GPU's compute resources.

Of course you could in theory have a compositor API that lets you do region-tracking for flat color areas, and this would save some power, but no system I know works that way.

comment 7y ago · link · parent

This will the the tl;dr of my upcoming blog post "the compositor is evil", referenced in the post.

I hear what you are saying, but I think the situation is a lot more complicated than that. Certainly, these days, if you're not using the GPU then you have failed; with high dpi and high frame rate displays, combined with the end of Moore's Law, CPU rendering is no longer viable. So the question is how you use the GPU. I agree with you that power is the primary metric of how we should measure this (it certainly correlates strongly to memory bandwidth, and is the metric users will actually care about; if there were a magical way to achieve high memory bandwidth at low power, I don't see any problem with that).

One way certainly is to use the compositor, and this is very seductive. The major platforms all expose an interface to the compositor, and it's generally pretty well optimized for both performance and power usage. Since animation is part of the API, it's possible to do quite a bit (including, for example, cursor blink in an editor) without even waking up the app process. Scrolling is another classic example where a compositor can do very well.

However, the compositor comes with downsides. For one, it forces the UI into patterns that fit into the compositor's data model. This is one reason the aesthetic of mobile UI design is so focused on sliding alpha-blended panes of mostly static content.

But even from a pure performance standpoint, heavy reliance on the compositor has risks. It's tempting to think of the composition stage as "free" because it has to blit the intermediate surfaces to the final composited desktop, but this is not strictly true. On mobile devices, and in the process of coming to desktops (there's some implementation in Windows 10 for Kaby Lake and higher integrated graphics) is the use of hardware overlays to replace actually blitting the active window to an in-memory surface. When the overlay is available, it's both a lower latency path and also saves the GPU memory bandwidth of that blit. And generally the heuristic is that the application window is a single surface, in other words that it does not rely on the compositor.

In order to justify doing the final scene assembly under GPU control in the app, that has to be as efficient or more so than the compositor. I have some evidence that, for 2D scenes typical of UI, this is possible. Regions that are flat color, for example (which occupy a nontrivial fraction of total area) can be rendered with no memory traffic at all, save the final output stage. And most of the other elements can be computed cheaply in a compute kernel on the GPU.

The tradeoffs are complicated, and depend a lot on the details of the application and the platform it's running on. In the 2010s, a strong case can be made that a compositor-centric approach is ideal. But in the 2020s, I think, it's increasingly not. The compositor is evil because it saps latency, and because its seductive promise of power and performance gains holds us back from the future where we can use the GPU more directly to achieve the application's rendering goals.

comment 7y ago · link · parent

Thanks, great resource. I've had Incremental explained to me by a Jane Streeter and I'm sure it influenced my thinking, but it's always good to have public explanations.

comment 7y ago · link · parent

Works for me (tested in Pixel / Chrome and iPad / Safari). A bug report, or better yet, PR against the repo would be welcome, not just for this but because I plan to use SVG for most of my 2D/GUI related content in the coming months. (And I have a lot planned!)

comment 7y ago · link · parent

You do need to trace all predecessors in this case, but in practice I don't think it's a serious problem. The kinds of graphs you'll get in UI are probably best thought of as trees with the possibility of shared resources (for example, all buttons of the same size might share the same background). On something like a theme change, I'd just rebuild the tree, although in theory you could be smarter and apply changes incrementally at a fine grain.

comment 7y ago · link · parent

Wow, that's seriously off topic for a post about build systems, isn't it? :)

The Rust ecosystem does not support "compiler plugins" well (by contrast, this is a first-class concept in Kotlin). What is being actively pursued is "procedural macros," but we're running into the limitations of those - we're moving away from them for deriving lenses, for example.

I'm sure it would also bring up lifetime issues, but, to be fair, those are probably similar to issues for async, and that only took a couple of years or so to land. But people are actively thinking about using generators for UI.

I do think this is one of the open questions. It might be that really first-rate reactivity does require language support in some way. But this feels like like increasing the scope of an already possibly overambitious problem.

comment 7y ago · link · parent

Well, that's quite the subtle question. Yes, in my plan for world domination, the representation of display lists is also immutable trees (or, more precisely, DAG's) hosted on the GPU, and the incremental nature of the pipeline is preserved, so small diffs to the UI result in small uploads of graph to the GPU. But it also includes damage region tracking, which is not really a tree, and the very end of the pipeline is pixels, which is definitely not a tree.

comment 7y ago · link · parent

From my recent Twitter mentions: Build Systems à la Carte (2018). This presents a theoretical analysis of build systems (which they have defined broadly enough to include Microsoft Excel) and how to pick and choose the various properties they provide.

This came up because I am promoting a conceptually similar unified theory of Reactive UI, which also has things in common with build systems. In fact, Svelte also happens to cite Excel as an inspiration for its approach to incremental updates. My blog post on this went live yesterday, and a birdie tells me it will hit the HN front page later today.

[1]: https://www.microsoft.com/en-us/research/uploads/prod/2018/0...

1397.

Towards a unified theory of reactive UI(raphlinus.github.io ↗)

206 points · by raphlinus · 7y ago · 35 comments

comment 7y ago · link · parent

It looks like it's shooting to be a lot lower level than Rust, probably Zig is a more apt comparison.

comment 7y ago · link · parent

Yes, we've been in touch, and I'm really excited to see this.

comment 7y ago · link · parent

Oh, they're not commercially available. My dad negotiated with an optical filter manufacturing company to make prototypes because I was interested in commercializing the idea. If you were going to do something similar today, very likely your best bet would be to get one side as EnChroma and the other as a neutral density filter (or a tint matching the EnChroma).

comment 7y ago · link · parent

It was many many years ago, so I unfortunately don't have the details. But yes, the process should be quite similar to EnChroma.

comment 7y ago · link · parent

There's actually a way for us to experience something similar: wear eyeglasses where the two lenses have different spectra. Then these "extra colors" show up as a shimmering sensation.

I have such a pair, but have to say it's not very exciting; there's not that much metamerism in the real world.

comment 7y ago · link · parent

Quite a few. Both the Berkeley grad program and working at Google will put you in touch with a fair number of gifted people, plus a few more through social and family circles.

Regarding my own children, this is complicated and I don't really want to talk about it here, but I'll say that their mom and I made sure to make opportunities available, but put a lot less pressure on them than I had when I was growing up.

comment 7y ago · link · parent

The college experience is about a lot more than job training. As I wrote in another response, it's about finding the best way to celebrate and nourish the thirst for learning new things.

comment 7y ago · link · parent

My parents worked pretty relentlessly to make opportunities for me. My mom was a professional librarian (still works a couple days a week), so we always had tons of books around. My dad made sure there were computers around - we built our first 8-bit kit when I was 6. Also he reached out to a lot of people who could be resources, for example when Niklaus Wirth gave a talk on Oberon at a University Maryland, he drove me out to see that.

I think (2) is a good question, but a huge one, I'm not sure what to say within a HN comment. I know it's a cliche, but certainly that being smart isn't everything, there's a lot more to life. The game-like recognition of academic credentials and so on is not as meaningful in the real world as it seems "in the bubble."

That said, what I think is a common thread of prodigies is a hunger and thirst for knowledge, to learn things. I carry that with me today, and think it's something to be nourished.

comment 7y ago · link · parent

Yes, and I would say my interactions around academic topics were pretty similar. I really loved hanging around University computer labs as a kid and young teenager, and that was no different at all when I got to Berkeley.

And yes, I was pretty isolated from other kids. Part of that story is that I grew up in a very rural, mountainous area. Looking back, I wish I had had more of a peer group. I wanted to go to the Johns Hopkins gifted program, but I think my parents were reluctant to let their little boy go into the big bad world. I regret they didn't.

comment 7y ago · link · parent

Did I say AMA above? I should have probably qualified that...

But I'll say this. I was very socially awkward as a kid and teenager. I dated some as an older teenager, but didn't feel quite comfortable until I got to grad school (at 22). Then I fell in with a peer group, got a really good friend group (who I still keep in touch with), dated and got married, had two kids, now divorced. So it's definitely part of my story, but my experience now is probably not all that different than most of my friends.

comment 7y ago · link · parent

I have had a very rewarding and fulfilling career, and am gratified that I'm now able to pursue the things that interest me most: tools for font design, high performance 2D graphics, Rust GUI. A lot of this is connected to the things I was interested in as a teenager.

comment 7y ago · link · parent

Short answer, yes. I was accelerated in the local high school, but that didn't work out for a number of reasons. So basically my dad decided I should take classes at the nearby college. It was unusual at the time and place, but he had quite a forceful personality.

comment 7y ago · link · parent

I started college at 9. Didn't actually graduate at the time, basically started doing computer projects on my own, then went back to school at 22 in the PhD program at Berkeley. I haven't made a huge deal about this, but am more open to talking about it now, especially if the experience helps other people. Feel free to AMA.
1
464748
63