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 3y ago · link · parent

Super good question. My thesis has both G2 and G4 continuous splines based on polynomial spirals ("spiro curves"), and the G4 definitely has more "wiggles," ie sensitivity to perturbations of the inputs. I imagine there is likely a general principle trading off locality with continuity, but am not able to quantify that rigorously.

comment 3y ago · link · parent

Seconded. A lot of the video runtime is covering fairly well known topics, but there are moments of brilliance, where it made things "click" for me. The treatment of the characteristic matrix and how the same matrix can derive both t and point parameterizations was particularly insightful.

comment 3y ago · link · parent

I'm very happy to see this work! The era of rendering vector graphics in GPU compute shaders is upon us, and I have no doubt it we'll start seeing these in production soon, as there's just such a performance advantage over CPU rendering, and I believe trying to run vector 2D graphics through the GPU rasterization pipeline doesn't quite work.

This code is simpler than Vello (the new name for piet-gpu), focused on vector path rendering. It's also a strong demo of the power of WebGPU, while also having a performant software-only pipeline. I definitely encourage people to take a closer look.

comment 3y ago · link · parent

A related question is why journalists didn't blow this open months earlier. Coffeezilla did a video a couple weeks ago where he has Marc Cohodes accusing Bloomberg of spiking the story because it would be bad for (crypto) advertisers. I find the accusation credible, even though all we have is this guy's word, because them not getting the story is something that really needs to be explained.

[1]: https://youtu.be/FDqhM7vHR2o?t=885

comment 3y ago · link · parent

Obviously it is юж.

comment 3y ago · link · parent

It's a new repo (and currently early days still) but we expect to build up the widget collection by doing a lot of adapting of the existing Druid widgets with generally minimal adaptation.

comment 4y ago · link · parent

I'm really happy to see this work, and am not even mad that the first Rust GUI toolkit to get the integration is egui. We intend to integrate AccessKit deeply in the UI work we're undertaking (the Xilem project, which is essentially a pivot to address the shortcomings in Druid).

Disclosure: Google Fonts funded Matt's work and I was involved in the decision to do so.

comment 4y ago · link · parent

I really wanted to get into Rust programming, but was turned off by the toxicity of the community. Their smug attitude of superiority really turns people away. I've been programming in C and C++ for decades, and I'm not sure I've ever once run into a problem with undefined behavior.

comment 4y ago · link · parent

> If Elon thinks this is some sort of big shock that will cause people to get excited.... I can't really see why.

Of course people will get excited. If Elon were to flog a "Hunter Biden's laptop" story that turned out to be that its hard drive was 4500 RPM when the SKU was marketed as 5400, and that capacity was measured in gigabytes rather than gibibytes, people would still get excited. Facts have little to do with any of this, it's all a post-modern, post-truth exercise in perceptions.

comment 4y ago · link · parent

The blog speaks to this explicitly, in the "what about unsafe Rust" section. The tl;dr is that the number of unsafe sections is a small fraction of the total code size, and it's much easier to audit the usage of unsafe, as the reason to justify it is focused. Thus, the use of unsafe in Rust is not a significant driver of actual vulnerabilities.

I think this has always been the goal, but it wasn't obvious at the outset that it would be achievable. The fact that we now have empirical evidence in real shipping products is significant.

comment 4y ago · link · parent

I have some stuff on real splines (their similarity and difference from the mathematical idealization) in section 3.12 of my thesis (page 39 of https://www.levien.com/phd/thesis.pdf).

There's also a bunch of stuff in there about Euler spirals (aka clothoids), including application to railways - see section 6.6, page 106. Fun fact, I'm going to get my first tattoo soon, and it will be an Euler spiral.

comment 4y ago · link · parent

So this is anecdote and not data, but I'm interacting a lot more with Quakers on Mastodon than I did on Twitter.

Honestly, I don't think services need to be dumbed down so much, people can figure it out. And having a little friction might be a good thing, unless the goal is just to rack up engagement numbers as high as they can be optimized - and arguably that incentive is one of the things that was really wrong with Twitter.

comment 4y ago · link · parent

TIL :)

comment 4y ago · link · parent

I've also moved from Twitter to Mastodon, for the same reasons, and have a similar experience - the raw follower count is still a fraction as before, but a lot of interesting people I want to connect with are already there.

And the feeling is... very different. There was lots about Twitter that subtly enraged me, like pop-sci Covid takes showing up in my algorithmic feed after I had extremely carefully curated my followers to only include actual scientists who knew what they were talking about. And it's also refreshing not to have all those ads. In general, I feel like you've got a lot of control of your Mastodon experience, if you curate your followers well, it can be quite good. I have rules of immediately "unfollow boosts of" anybody who posts viral "boost this if..." or bullshit polls, and that's cleaning up my feed as well.

I've also been followed by my first crypto account (so I might go to followers-need-approval), and have seen glimmers of the same kind of dumb drama you see on Twitter, but overall feel like I generally have the tools I need to keep all that in check. I was finding that Twitter was bad for my mental health, and took a bunch of breaks from it even when I was having generally positive interactions and finding good info. We'll see how this goes, especially as things scale.

comment 4y ago · link · parent

I got "Install the NuGet package manager on a Mac" which I'm still not sure is ridiculously infeasible or the kind of hack somebody might actually manage to pull off. Definitely HN-worthy if they manage it!

comment 4y ago · link · parent

Or, if you prefer Mastodon: https://mastodon.online/@kenshirriff@oldbytes.space/10941232...

comment 4y ago · link · parent

Yeah, the way I sometimes describe this is that Rust social media can be pretty toxic, but the actual Rust community is generally very friendly and supportive. The problem is that a lot of people confuse the two.

comment 4y ago · link · parent

The `fast_decode` as written is undefined behavior for some inputs (INT_MAX for example) because of the integer overflow in `2*x`. This can be fixed by casting to an unsigned int first.

Also a warning, right shifting a negative number gives the expected result (arithmetic right shift) in C++20, but is still implementation defined even in the C23 draft spec. Likely you're good, but the spec doesn't guarantee it.

comment 4y ago · link · parent

What I think has happened is that the culture wars are taking over more and more topics. Not only the obvious stuff like race, LGBTQ+ rights, crime, and labor, but increasingly things that don't traditionally fall on the left/right axis: vaccines, lab leak theory, content moderation, and even programming languages to some extent (admit it, the representation of trans people in the Rust community triggers some people).

One thing that gets me is that, putting aside the question about whether one side or the other is right, the culture war stuff is just incredibly stupid. It's like people have gotten a lobotomy and their ability to do critical reasoning and respond to empirical data has been replaced with just pure tribal identity. My sense is that this is happening across the country (and perhaps to some extent the world), and HN actually has it easier than a lot of other places.

comment 4y ago · link · parent

I think it's potentially in scope, but optional - there are other problems more urgent to solve, and then with more powerful compute and font technology, it's possible to go past TeX into microtypography (some of which was done in hz, but not really widely adopted). Either way, to do Knuth-Plass paragraph optimization, you need lots of metrics of the words to decide the line breaks, and to do the micro stuff, you need even more fine-grained information from the font. Breaking that across a process boundary is... tricky.

comment 4y ago · link · parent

How does it work? How does it compare to other published work, including piet-gpu? I'm seeing about 5ms for tiger on a Pixel 4, which is probably comparable as the iPad no doubt has a much stronger GPU.

comment 4y ago · link · parent

I've been thinking of writing more. Doing real text layout is one of the tricky bits, and one that terminals sidestep because layout calculations are trivial as long as you narrow scope down to grids of monospaced ASCII characters.

comment 4y ago · link · parent

To some extent, the architecture of xi-editor was inspired by similar thoughts - not escape codes, but updates to the UI specified as JSON-RPC, and with one process handling the nitty-gritty of UI, the other (in Rust, but conceptually language agnostic, in fact Go was under serious consideration) specifying the application logic. The original implementation only stood up an editor, but making that rich enough to support a full IDE experience could conceptually support other GUI applications. I wasn't particularly familiar with MGR, but the Blit[1] had somewhat a somewhat similar flavor and was definitely on my radar. We even considered the possibility of running the protocol over the network, because at heart it's just byte streams (and already somewhat optimized, as the idea was to use intelligent diffing to minimize the work needed to be done by the UI process).

It didn't work out. It turns out to be very complex to support modern UI, and making it async upped the complexity even more. I'm not saying this couldn't be done, but these days I'm much more interested in UI architectures where everything is in process and more tightly coupled.

[1]: https://en.wikipedia.org/wiki/Blit_(computer_terminal)

comment 4y ago · link · parent

I was quite impressed with the FreieFarbe[1] presentation at Libre Graphics Meetup 2019. It is an open source service that actually does attempt to provide similar value as Pantone, not just the naming of sRGB colors. In particular, they've put nontrivial work into calibrating it to physical colorants.

[1]: https://www.freiefarbe.de/en/

comment 4y ago · link · parent

I love these kinds of things and use them in GPU programming, among other things. Things have changed in a variety of ways: population count and count-trailing-zeros are generally available as fast instructions now. Multiply is also now just as fast as other operations, so is not to be avoided.

A couple examples. [1] computes the sum of the number of bytes used of four consecutive segments of a bezier path - each segment can be lineto, quadto, or curveto, can be the end of a path or not, and be i16 or f32. 4 tag bytes are packed into a 32 bit word, it computes all these, then sums them together.

[2] linearizes a recursive subdivision into an iterative loop. The stack depth is represented as the number of zeros in a word, so pushing the stack is a left shift, and popping is a right shift. It turns out you want to pop multiple levels at once, and the number of levels is computed by countTrailingZeros. ([2] is experimental Rust code, but I will adapt this into a compute shader)

[1]: https://github.com/linebender/piet-gpu/blob/main/piet-wgsl/s...

[2]: https://github.com/linebender/kurbo/blob/euler/src/euler.rs#...

comment 4y ago · link · parent

> GPUs don't yet have a well-defined memory model

Vulkan has a perfectly fine memory model, and it's non-optional in Vulkan 1.3. The rest of GPU land of course has some catching up to do. It guarantees atomicity but does not guarantee progress (there's active work on characterizing that). And fairness is probably not something you want, as it almost always comes at a performance cost.

comment 4y ago · link · parent

Also see the twofloat crate in Rust, which uses a pair of f64's to give double the number of significant digits as a standard f64. The linked docs point to a number of academic papers on the subject.

[2f]: https://docs.rs/twofloat/latest/twofloat/

comment 4y ago · link · parent

Some more wild shady spy activity against whistleblowers documented here: https://twitter.com/HindenburgRes/status/1575557272532811778

comment 4y ago · link · parent

Perhaps the rule in the standard is simple - the compiler can arbitrarily round to finer precision than IEEE, but in practice it's complicated as the same code can behave quite differently depending on what chip it's compiled for, the level of optimizations, and other factors. If you want to control it, ie model it as something other than nondeterminism, figuring out the right combination of compiler flags and so on is tricky.

I'll also point out that fma is relatively new, so it's pretty easy to write code that works fine when compiled with default x86_64/SSE2 but will break when compiled for a more recent target cpu.

comment 4y ago · link · parent

The actual rules are very complicated. C allows greater precision for intermediate results but compilers are sometimes careful to stick to IEEE rounding. [1] contains a good general overview, and [2] talks about FMA in particular. And in [3] I've set up a Godbolt example to play with. By default -O3 gives you FMA, but -O or -O3 with -ffp-contract=off don't. So you absolutely can get different results depending on optimization levels.

[1]: https://randomascii.wordpress.com/2012/03/21/intermediate-fl...

[2]: https://kristerw.github.io/2021/11/09/fp-contract/

[3]: https://godbolt.org/z/eTz8o6b3P

1
141516
63