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

Klingon has a much more complicated history than this. The usage of Klingon is higher than many of the obscure things encoded in Unicode, so that's not the full reason. The real reason is most likely that Paramount considers the Klingon language its intellectual property and has attempted to enforce it[1]. Thus, I believe the official position of the Unicode consortium is that Klingon is written in Latin script but with a Klingon font (ie is basically a simple substitution cipher with a handful of ligatures), which satisfies everybody except for those who want Klingon included in Unicode.

ETA: The proposal[2] has been revived recently, and in the committee meeting[3], they're clear that the blocker is legal.

[1] https://ipkitten.blogspot.com/2016/05/to-boldly-go-where-no-...

[2]: https://www.unicode.org/L2/L2020/20181-klingon.pdf

[3]: https://www.unicode.org/L2/L2020/20169-script-adhoc-rept.pdf

comment 5y ago · link · parent

I still like snowflakes for this: https://levien.com/snowflake-explain.html is a half-finished blog post explaining the motivation and algorithm I came up with. I never did careful user testing, but suspect that the answer would be that some people can reliably distinguish the patterns, others won't be able to.

In any case, there are a lot of variations on this "visual hash" idea, including the original fractal one, and I heard of more recent work to use the hash to seed StyleGAN face generation.

comment 5y ago · link · parent

Thanks. I've made a substantial donation to ASAN listed as being in her honor. I'm also a fan of SFC and plan to continue to support them.

comment 5y ago · link · parent

This is top-notch and very impressive work. I'm currently in the middle of tuning performance of piet-gpu for the Pixel 4[1], and I find myself relying on similar open resources from the Freedreno project. When the time comes to get this running efficiently on M1, having detailed knowledge of the hardware will be similarly invaluable - just the info on registers and occupancy is an important start.

Is there a way to support the work?

[1]: https://github.com/linebender/piet-gpu/issues/83

comment 5y ago · link · parent

The "cargo apk" tool already exists to bundle Rust code into a NativeActivity that can be run without needing to write any additional Java code. The API surface so provided is more limited than the full toolkit, but could be useful in many domains. It's currently mostly used for games. I am using it for the Android port of piet-gpu, and it's working pretty well.

comment 5y ago · link · parent

I recommend the Meyerowitz-Katz and Merone survey of IFR [1] over Ioannidis. The tl;dr is an IFR estimate 0.68%. Consensus in the epidemiology community is that Ioannidis has become a politicized hack, consistently pushing lowball estimates.

Of course, your argument is still valid even with the lower estimate, I just think it becomes more complicated. Unfortunately, this case is quite a bit more complicated because COVID fatalities are heavily weighted to older ages, while this purported VIPIT is appearing largely in younger, otherwise healthy people.

[1]: https://www.medrxiv.org/content/10.1101/2020.05.03.20089854v...

[2]: https://sciencebasedmedicine.org/what-the-heck-happened-to-j...

comment 5y ago · link · parent

I personally think these "news reporting" style articles aren't all that helpful in understanding the issues. Context matters a lot. Here's an article I strongly recommend:

https://www.theatlantic.com/health/archive/2021/03/astrazene...

This is not a simple issue. The implications are serious in Europe in the short and medium term, as they're quite far behind in vaccinations compared to the US and UK. Then the implications for global health equity are even more worrisome.

comment 5y ago · link · parent

A little digging with Internet Archive reveals that this is an entirely legitimate source:

https://web.archive.org/web/20140216040930/http://www.cdc.go...

comment 5y ago · link · parent

They say "don't read the comments," but taking that advice would have led me to miss https://www.youtube.com/watch?v=MUw3s4evhTE . That is a 7 minute video of science comedy that had me laughing out loud at several points, and its punchline is directly relevant to the question at hand here.

comment 5y ago · link · parent

Interpolate in a perceptual space such as Oklab?

Possibly use a radial basis function for interpolation rather than triangles? I don't have JavaScript code handy but rbf-interp[1] is Rust code that could either be adapted or called from wasm.

[1]: https://crates.io/crates/rbf-interp

comment 5y ago · link · parent

I think it got better, but unfortunately I never filed a bug documenting the bloat, so it's hard to track down what changed, or if I was simply wrong. My recollection is that most of the bloat was a per-invocation copy of the panic code, including formatting of the error message.

Class declarations are still heavy, cargo-bloat on the current druid-shell library is showing about 900 bytes per add_method, which can add up but is unlikely to be a major source of bloat.

comment 5y ago · link · parent

Yes. I think the characterization in TFA is still valid.

comment 5y ago · link · parent

A large offender is the fontinfo[1] struct, which is serialized with serde and quick-xml. Other parts (the glyphs etc) are done with quick-xml and handwritten code.

[1]: https://github.com/linebender/norad/blob/master/src/fontinfo...

comment 5y ago · link · parent

Right. Dumping internal memory representations is one point in the spectrum, with extremely appealing properties for compile time, code size, and run time (basically no cost), but other serious problems, including portability (32 bits or 64 bits for pointers) and security. Many of the zero-copy serialization formats (Flatbuffers, Cap'n Proto, FIDL) are inspired by this and to some extent have the property that a "plain ol' data" struct might be serialized by a memcpy of the C representation, but try to improve in the other dimensions.

That said, I don't think dealing with the byte representation is the real problem. Projects like simdjson show that you can convert in and out of JSON very fast. The challenge to bloat specifically is getting those converted to the data types of the application. Many serialization approaches, including serde, generate a goodly amount of code for each data type, and this adds up.

comment 5y ago · link · parent

The ICU4X project[꧁] is working on some of those goals, and they're also using Rust as a primary implementation language.

[꧁]: https://github.com/unicode-org/icu4x

comment 5y ago · link · parent

It's something we thought about, but I think it's somewhat orthogonal to the question of serialization - you still need code to go back and forth between the representation in the database and the native data structures.

See https://github.com/simoncozens/babelfont/issues/10 for a deeper discussion of issues around a file format for a font editor. One of the biggest current pain points is dealing with merges in version control (usually git). I think there are ways of dealing with that in an sqlite-based file format, but I worry it would require some custom tooling, especially to make sure invariants aren't violated. Another interesting example is LibrePCB (see https://www.youtube.com/watch?v=vu-h5y6tK34) who devised their own text based format specifically to make version control more friendly.

comment 5y ago · link · parent

This was written a year and a half ago, but I think holds up pretty well. Some thoughts.

First, one lesson is that the exact wording in headlines matters. Many people interpreted the essay to say "Rust has a bloat problem," which is not what I was trying to say. Bloat is unfortunately a super common problem in the modern world, and Rust is not immune. But Rust also gives the end developer a lot of control, and is capable of producing wicked-lean programs (at some cost) if that's the goal. The point of the essay was to give practical advice on how to reduce compile times and executable size. From that perspective, publishing the essay was a pretty big success, as it immediately provoked improvements in the gfx-hal project.

Serialization continues to be a problem. Now, something like half the compile time and executable size for Runebender is serialization for the XML-based UFO file format for representing fonts. I think a better solution to serialization might make a good project for a smart, motivated person, but it's pretty far away from current academic fads, and there's also this thing that a lot of people have tried and we're still not in a great place. What about serialization makes it so intractable? Could some kind of language support make it better?

Also, from followups in UI threads, the expectation for what constitutes "bloat" is very different for different people. The calculator example in Druid is now about 1.5M (release build, Windows), which I think is acceptable for most people, but I'm also aware that a simple calculator like that could be built in a couple hundred k or so without too much problem, and I'm sure much less if you start using demoscene style techniques. But I also don't want to focus on that too much - I don't want tiny calculator demos, I want rich applications that work in all languages (including input methods) and also play nicely with accessibility tools such as screen readers. That can't be, and shouldn't be, a tiny little executable.

comment 5y ago · link · parent

That's actually the point I'm trying to make here. The HCQ boosters have the support of a large faction of a major political party in the US, including a governor who recently hosted a roundtable featuring a number of prominent modern-day Lysenkoists including Dr. Atlas.

comment 5y ago · link · parent

Ok, I'll grant the evidence is not yet in on ivermectin, but that hasn't stopped many of the same folks as were advocating HCQ from pushing it.

The paper to be published in Frontiers of Pharmacology was pulled because it didn't meet the scientific standards of the journal. Or perhaps because the editorial board has an anti-ivermectin agenda and censored the maverick scientists.

https://www.the-scientist.com/news-opinion/frontiers-removes...

Another story on this I found fairly credible: https://www.medpagetoday.com/infectiousdisease/covid19/90552

And here's an authoritative source (the NIH): https://www.covid19treatmentguidelines.nih.gov/antiviral-the...

They conclude that the evidence is not yet strong enough to recommend for or against the use of ivermectin. My accusation of Lysenkoism is for the people prescribing it without solid evidence. Obviously if the drug shows promise it should be investigated in real trials, as was done for HCQ.

I'm not going to edit my original post but I think it would have been stronger if I had stuck to HCQ and not gotten into the ivermectin controversy - there's definitely still a chance it will turn out to be useful.

comment 5y ago · link · parent

I found this story interesting, largely because of the parallels to today. Scott Atlas to me is clearly cut from the same clothe as Trofim Lysenko, and the use of hydroxychloroquine and ivermectin for Covid are the modern-day equivalent of Lysenkoism. I always wonder if these people are smart and know what they're spouting is bullshit, or just too stupid to realize it. In the end, it probably doesn't matter, the outcome is the same.

comment 5y ago · link · parent

Not specifically in relation to this latest Norwegian claim, but an excellent backgrounder on the blood clot problem: https://www.sciencemag.org/news/2021/03/it-s-very-special-pi...

comment 5y ago · link · parent

Moderna ready to test version of Covid-19 vaccine aimed at worrisome variant: https://www.statnews.com/2021/02/24/moderna-ready-to-test-ve...

Covid-19: Where are we on vaccines and variants? https://www.bmj.com/content/372/bmj.n597

comment 5y ago · link · parent

The original piet-metal codebase has a tweak where very thin lines are adjusted to thicker lines with a smaller alpha value, which improves quality there. This has not yet been applied to piet-gpu.

One of the stated research goals [1] of piet-gpu is to innovate quality beyond what is expected of renderers today, including conflation artifacts, resampling filters, careful adjustment of gamma, and other things. I admit the current codebase is not there yet, but I am excited about the possibilities in the approach, much more so than pushing the rasterization pipeline as you are doing.

[1]: https://github.com/linebender/piet-gpu/blob/master/doc/visio...

comment 5y ago · link · parent

I think the world is going into a more layered approach, where it's the job of the driver API (Vulkan etc) to expose the power of the hardware fairly directly, and it's the job of higher levels to express the actual rendering in terms of those lower level primitives. Raytracing is an exception because you do need hardware support to do it well.

Whether there's hardware that can make 2D rendering work better is an intriguing question. The NV path rendering stuff (mentioned elsethread) was an attempt (though I think it may be more driver/API than hardware), but I believe my research direction is better, in that it will be higher quality, faster, and more flexible with respect to the imaging model on standard compute shaders than an approach using the NV path rendering primitives. Obviously I have to back that up with empirical measurements, which is not yet done :)

comment 5y ago · link · parent

The skia-compute project is now Spinel, and is under Fuchsia. It is very interesting, perhaps the fastest way to render vector paths on the GPU, but the code is almost completely inscrutable, and it has lots of tuning parameters for specific GPU hardware, so porting is a challenge.

Skia has a requirement that rendering of paths cannot suffer from conflation artifacts (though compositing different paths can), as they don't want to regress on any existing web (SVG, canvas) content. That's made it difficult to move away from their existing software renderer which is highly optimized and deals with this well. Needless to say, I consider that an interesting challenge.

comment 5y ago · link · parent

Hi again! This post was an early exploration into GPU rendering. The work continues as piet-gpu, and, while it's not yet a complete 2D renderer, there's good progress, and also an active open source community including people from the Gio UI project. I've not long ago implemented nested clipping (which can be generalized to blend modes) and have a half-finished blog post draft. I'm also working on this as my work as a researcher on the Google Fonts team. Feel free to ask questions in this thread - I probably won't follow up with everything, as the discussion is pretty sprawling.

comment 5y ago · link · parent

As far as I know, I'm the first to propose a solution that includes the equal-area constraint as part of the solution, though it is mentioned in the Penner paper as part of the search that led to the saddle point ODF solutions.

The technique should definitely work for path merging, that's a primary motivation. I'm not sure I understand your other questions. It'll probably be clearer when I release some code that implements this algorithm, though I'm not making any promises when that might be.

comment 5y ago · link · parent

I'll see if I can do something with this. I kept myself to the viridis color map and just log + clamp because I didn't want to misrepresent the data, but I think you're right.

comment 5y ago · link · parent

I think I understand, you're talking about the numerical integration, right? It's probably something of an academic question because you can just set the error to 1e-9 or whatever, and the convergence of that approximation is so good it doesn't slow you down appreciably.

That said, there are other things you can do. Since the derivatives of an Euler spiral are easy enough to compute analytically, you could do Hermite interpolation with a polynomial of arbitrarily high order. I've worked out how to do it for quintic, which is pretty tractable, but I'm sure it could be done even higher. That definitely meets your stated goal (precise at endpoints, sloppy in the middle), but the order of convergence of a quintic is only moderately good compared to the higher order polynomials in spiro.

comment 5y ago · link · parent

My blog post is basically an angry rant against this kind of technique, though it's polite and civil in tone :) Basically, it's slow because it takes a number of iterations instead of directly calculating the best-matching curve, and it can fall into a local minimum and fail to attain the global optimum in case it's in one of the other two of triplets of similar shapes characteristic of cubic Béziers.
1
303132
63