Live data from Hacker News

Ladybird browser to start using Swift language this fall

twitter.com

161–170 of 205 posts

Re: Ladybird browser to start using Swift language this fall

#161

Earlier quoted context omitted.

> start contributing to Servo Servo as a browser is (sort of) dead, though webrender still lives. I remember when (back when the icon was a doge) it had an actual UI and could be used as a real web browser... that's all been stripped out now. https://book.servo.org/ : > Work is still ongoing to make Servo consumable as a webview library, so for now, the only supported way to use Servo is via servoshell, our winit- an…

Servo was never usable as a "real browser", and it's been revived since last year by Igalia. Looks like you should refresh your view on the project overall.

> Servo was never usable as a "real browser"

I had a 2018 (or 2017?) build on my Mac that was a native app using Cocoa/AppKit, which had a URL bar and could do most things in a functional capacity (like using Google services). AFAIK I tried a newer build back in 2020 or 2021 which had stripped out all of the browser chrome (like URL bar). Maybe they had intended to add it back in the future, but didn't get to do that before, you know, the layoff.

Servo the project was never revived as it was originally; the Servo name is being reused for what is actually a continuation of just the webrender project, which was part of the original Servo project, but is nonetheless much more limited in scope. I know it's confusing. Servo was once going to be a browser plus engine, and now it's just the engine.

Of course, officially, Servo has always only been a "research project" to "rethink the browser at every level of the technology stack", which primarily meant "layout engine", but then again, they did do such things as creating their own bindings to macOS Cocoa and AppKit which has no place in a layout engine, just to create, you know, a browser that demonstrates the engine. The browser that used the engine was part of the project.

Nowadays, the new Servo does have a demo/example project, but it's not meant for end use like the original Servo browser would have been. It just uses egui and all the other parts of the original Servo project have been essentially deprecated in favor of the new one, which is just webrender.

Re: Ladybird browser to start using Swift language this fall

#162

I had suspected this would happen, I haven’t got into Swift yet (I’m mostly doing embedded C still) but Swift finally seems to have just ticked off some niggles that makes it a much stronger contender. Things like not having official Debian builds (there were Ubuntu etc.), not being able to run under other C libraries like musl (like if you want to run in Alpine Linux containers), not really being able to run embedde…

Honestly, Swift seems like such a nice language. Most of the performance and power, great interop, but more directed at application development than Rust (with e.g. refcounting being the default). But as they say, you choose a language for its ecosystem, not for the language itself. It would be great if Swift’s open source ecosystem for stuff other than app development grew. It does indeed seem like Apple is pushing…

I have about 30k lines of Swift in my app + Matrix sdk, all heavily using async/await. Plus another couple kloc in a Vapor API backend.

Swift async/await is quite nice.

The Actor stuff is IMO way oversold - reentrancy issues make it not actually useful for the things that they claim, like querying a database. It’s still a useful construct to have, you just need to be aware of what it does or doesn’t provide.

Re: Ladybird browser to start using Swift language this fall

#163

Earlier quoted context omitted.

“They” is particularly convenient when discussing about people over the internet, because not only we don't have to assume the person's gender, but we don't have to assume if it's an individual or a group either. And tbh using gender in pronouns is artificially annoying, and it's good to see English has a way out of it, like it got rid of giving genders to common objects like most European languages (“Non, it's La ch…

Languages hold complexity in different areas, but that doesn't make it artificial . Grammatical gender (and noun classes more generally) may seem redundant, but redundancy in language is quite common. It helps disambiguate, as it turns out speech (especially, but writing too) is a very lossy method of communicating. (You seem perfectly happy distinguishing between animate/inanimate nouns and choosing "it" or "he/she/…

1. "it" does not distinguish between animate and inanimate nouns:

The baby grunted again, and Alice looked very anxiously into its face to see what was the matter with it. — Lewis Carroll, Alice's Adventures in Wonderland

But he [Jesus] said to them, "It is I; do not be afraid." — John 6:20

2. gender distinction is artificial because it's not based on anything real, rather it's based on whether the "vibes" that a person (or an inanimate object in European languages) that you're referring to gives off are more feminine or more masculine. this "redundancy" creates all sorts of trouble for folks who are not comfortable with the "vibes" society assignes them with a particular gender at a given moment. the problem here is not that the speech is lossy, but that this particular "feature" of language demands that you convey the person's identity when it's almost always irrelevant in a way that's exclusive to gender (thank God nationalism wasn't invented when the language was forming)

Re: Ladybird browser to start using Swift language this fall

#164
post #148

Earlier quoted context omitted.

The degree to which GC issues in the context of deterministic memory management apply to C# is incomparably lower to pretty much every other language that offers GC (especially JVM family) or a similar automatic memory management capability (except Swift or D). However, D's GC is very rudimentary, and Swift pays very hefty performance price imposed by ARC for lower memory footprint and somewhat more predictable memor…

Until Zig has a good story for use after free, I wouldn't be considering it. Regarding C#, there was some research work at MSR for improving escape analysis and IDispose usage via lifetime analysis, but seems to never have moved beyond proof of concept. By the way, Midori internal presentation from 2013 is doing the rounds on twittersphere.

I don't think there was any work on escape analysis in current .NET related to Midori, at the very least not in public. However, there has been separate research and support for object escape analysis unrelated to this.

Here's the rough timeline of the work:

Initial issue https://github.com/dotnet/runtime/issues/11192 was submitted in 2018 and concerns general research direction on feasibility and profitability of EA.

At the time, the results were very unpromising given compiler throughput impact: there were very few objects that were not escaping due to inlining limitations and (relatively) rudimentary approach to EA. In addition, there obviously was no impact on performance sensitive code that just used structs instead that are not reliant on fragile optimizations like this one.

Here, I would like to add a personal note that .NET teams are exposed to a much more well-behaved code and there existed (and still exists to an extent) bias that overlooks the nastiest and worst codebases that, no matter their issues and unnecessary allocation on every step, are an important optimization target. I think today there is a good degree of awareness and understanding of this bias, which drives further compiler improvements.

Back to EA. After initial research was done, the relevant code was merged into JIT - the feature was added around .NET 5 but remained disabled by default. Later on, it was occasionally in a broken state and generally not well validated against, given nothing used it besides compiler tests.

This, however, has changed in .NET 9. In order to understand why we first have to consider what were the changes in .NET's compiler in the previous versions.

Before .NET 7 and 8, JIT had nice but limited capability to perform something Java calls "scalar replacement" except for structs, the .NET name for this is "struct promotion". This feature "promotes" constituent struct fields to individual local values which are then stored in CPU registers or individual stack locations instead of "together" and being copied every time. This also included other common cases like treating single-field structs as an underlying field (making such wrappers effectively free). At the time, this optimization was great but nevertheless limited - there were restrictions on the amount of fields which could have been "promoted" and "enregistered" (up to 4 I believe?) as well as the depth - the quality of compiled code could easily regress if the target of promotion was nested within another struct, etc etc.

In order to address this, a new handling of struct promotion was introduced - "physical promotion": https://github.com/dotnet/runtime/issues/76928. This did away with the limitations of the past and enabled significantly better[1] handling of structs, allowing them to be optimized away, promoted without depth and count restrictions, propagate constants and assertions through struct fields, CSE more expressions on struct and more. This was a significant overhaul which pushed .NET's compiler output quality concerning structs way closer to the kind of behavior you would usually expect from GCC and LLVM.

At this point, I think you have an idea where this is leading to. Come in https://github.com/dotnet/runtime/pull/102808, an unrelated change which enabled the compiler to reason about propagation of addresses (object references, byref and unmanaged pointers) through struct fields. However, the importance of this change is that Steve (hez2010) noticed[0] that it may have closed the critical gap that previously prevented generalized optimizations enabling optimal struct handling from being applied to objects allocated on the stack. Once it was merged, it made the simpler scenarios EA was working for to produce the same optimal codegen you would see from structs as of .NET 8.

This and related discussions prompted further work on analyzing the most common unescaped allocation patterns and resulted in https://github.com/dotnet/runtime/pull/103361 by Andy Ayers. Once it was merged, it extended supported cases by previously limited EA capability, tuned inlining heuristics to make it light up more often and proved that the way it was handled as of the change was noticeably more profitable. It was subsequently enabled for NativeAOT and R2R as well: https://github.com/dotnet/runtime/pull/104411

As a result, .NET 9 will come with improved escape analysis capability, now enabled by default. It is still fairly limited but nonetheless an another change that incrementally adds to the nice "free" performance improvements everyone has grown to expect from bumping up a TFM version with each release for the last 7 years or so.

Further EA work is planned https://github.com/dotnet/runtime/issues/104936 and there are already initial experiments for .NET 10 like this one https://github.com/dotnet/runtime/pull/104906

I don't claim this timeline/sequence of events is perfectly accurate but I hope it sheds light on how and why this optimization has been evolving in .NET so far.

[0]: https://github.com/dotnet/runtime/pull/102808#issuecomment-2...

[1]: https://devblogs.microsoft.com/dotnet/performance-improvemen...

Re: Ladybird browser to start using Swift language this fall

#165
post #163

Earlier quoted context omitted.

Languages hold complexity in different areas, but that doesn't make it artificial . Grammatical gender (and noun classes more generally) may seem redundant, but redundancy in language is quite common. It helps disambiguate, as it turns out speech (especially, but writing too) is a very lossy method of communicating. (You seem perfectly happy distinguishing between animate/inanimate nouns and choosing "it" or "he/she/…

1. "it" does not distinguish between animate and inanimate nouns: The baby grunted again, and Alice looked very anxiously into its face to see what was the matter with it. — Lewis Carroll, Alice's Adventures in Wonderland But he [Jesus] said to them, "It is I; do not be afraid." — John 6:20 2. gender distinction is artificial because it's not based on anything real, rather it's based on whether the "vibes" that a per…

1. Yes, as with many "rules" in language there are exceptions. I would find it a bit odd to refer to a baby as "it" in (current) English, though I do admit there are some situations where it wouldn't feel as out of place.

In my read of the Bible quote, it's not really referring to a person as "it" in the same way.

2. Grammatical gender has nothing to do with the "vibes" of an inanimate object - it's quite arbitrary, really. The problem you're associating here is much more with gender in humans, but we were talking about the grammatical construct applied to objects (like a chair as the grandparent mentioned).

Re: Ladybird browser to start using Swift language this fall

#166
post #44

Earlier quoted context omitted.

I love Rust but have to agree that there is a lot of truth in all of those. The Rust community really should take a look at more welcoming and diverse communities like the Ruby and PostgreSQL communities. Not sure though what can be done to make handling long-lived state less clunky.

What about the Rust community is not welcoming? Ruby has had its fair share of community controversies, so that's an odd choice for comparison.

Most have controversies and trivalism.

Re: Ladybird browser to start using Swift language this fall

#168

Earlier quoted context omitted.

A fun fact I learned just recently is that even Shakespeare used singular "they": http://itre.cis.upenn.edu/~myl/languagelog/archives/002748.h... (and even singular "themselves" !) which puts to rest approximately every argument I've ever seen against it.

It was also used in the King James Bible, published in 1611.

Interesting. Shakespeare had first used singular 'they' in 1594, so not even that long before.

Re: Ladybird browser to start using Swift language this fall

#169
post #61

Earlier quoted context omitted.

It could be an age thing. When I was taught grammar 40 plus years ago, for someone of indeterminate sex, “he” was taught as always appropriate, “he or she” was a somewhat clunky alternative that was situationally appropriate where you were stressing the gender neutrality, and “they” was just simply bad grammar which would get you bad marks. I’m honestly not sure when that changed.

“They” is particularly convenient when discussing about people over the internet, because not only we don't have to assume the person's gender, but we don't have to assume if it's an individual or a group either. And tbh using gender in pronouns is artificially annoying, and it's good to see English has a way out of it, like it got rid of giving genders to common objects like most European languages (“Non, it's La ch…

> not only we don't have to assume the person's gender, but we don't have to assume if it's an individual or a group either.

as someone with DID (formerly called Multiple Personality Disorder) this is actually kind of a nice bonus. (though people still often use he/him pronouns to refer to specifically me, which is fine)

Re: Ladybird browser to start using Swift language this fall

#170
post #163

Earlier quoted context omitted.

1. "it" does not distinguish between animate and inanimate nouns: The baby grunted again, and Alice looked very anxiously into its face to see what was the matter with it. — Lewis Carroll, Alice's Adventures in Wonderland But he [Jesus] said to them, "It is I; do not be afraid." — John 6:20 2. gender distinction is artificial because it's not based on anything real, rather it's based on whether the "vibes" that a per…

1. Yes, as with many "rules" in language there are exceptions. I would find it a bit odd to refer to a baby as "it" in (current) English, though I do admit there are some situations where it wouldn't feel as out of place. In my read of the Bible quote, it's not really referring to a person as "it" in the same way. 2. Grammatical gender has nothing to do with the "vibes" of an inanimate object - it's quite arbitrary,…

Babies are weird. So are animals.

So, as far as I understand it, gender pronouns are typically for referring to individuals. This means that whether to call a baby, or animal, by gender pronouns or object pronouns varies depending on the expectation.

('gender pronouns' includes singular they/them, which is a 'gender pronoun' in the way that it perhaps, if you will, implies the 'gender' of 'neuter'...)

I guess a generally understood term for this would be "humanization", although as someone who identifies non-human that still sounds somewhat exclusive, but regardless, that is what I generally observe to be the difference.

So, it's possible to refer to a baby or an animal as an object, if, in doing so, you intend not to assign that object any individuality; in other words, if you're referring to it in a non-individualistic way.

e.g. "I needed to change its diaper again today" ("dehumanizing"; I guess shows a lack of empathy, but not everyone necessarily feels empathy for the baby before it is more markedly an individual)

It's also possible to refer to a non-individual (such as an inanimate object) as an individual, which, in doing so, typically implies that the non-individual nonetheless has some sort of individuality or that you're specifically assigning it such.

e.g. referring to ships / other vehicles using 'she'; also, giving everyday objects individuality is a relatively common part of Japanese culture (which is part of why Apple's recent "Crush!" ad upset so many)

Typically, it's respectful to refer to people as individuals because they are. It is "dehumanizing" to suggest otherwise. (seriously, is there a better word for this?)

Some prefer to be referred to as objects instead, though; I know at least one like this. But those will typically specify it in some way, and it's rude not to refer to any one as an individual unless otherwise specified.

Post reply on HN