News for hackers. Stuff that matters.
Re:Implementing Font-Size in Servo: An Unexpectedly Complex ... by pcwalton on Friday August 11, 2017 @12:41PM (#14991649)
Setting font size in pixels on an inline style is as fast on the Web as, say, changing the font on an NSTextFieldCell. Why wouldn't it be?
Re:Implementing Font-Size in Servo: An Unexpectedly Complex ... by Manishearth on Friday August 11, 2017 @02:04PM (#14992607)
To expand on this, CSS totally supports the basic performance of styling native apps provided you use features with the ergonomics of styling native apps (i.e. inline styles).

It's when one wants to be able to better declare what the styles will be that you have performance implications, and as pcwalton says these are worse for native styling frameworks since they don't have much optimization work put into them.

(Also, wrt the original comment, all this font-size handling isn't particularly a perf issue. There are other minor font perf issues, but this isn't one)

Re:Implementing Font-Size in Servo: An Unexpectedly Complex ... by vanderZwan on Friday August 11, 2017 @02:55PM (#14993038)
You're again talking about current performance.

The full HTML and CSS spec is large, complicated, and full of corner cases, and thus a lot harder to optimise. The point GP is making is that a simpler framework is much easier to maintain and optimise because it has much less to worry about (again, in principle).

I think the key difference is this part of your earlier reply:

> when native apps support styling

.. when the implicit statement Illnyar was comparing CSS to a framework that doesn't support styling, or at least much simpler styling.

I'm not hating on browsers, HTML or CSS here - they're amazing technologies. But these are two different points being made.

Re:Implementing Font-Size in Servo: An Unexpectedly Complex ... by pcwalton on Friday August 11, 2017 @03:59PM (#14993570)
Can you explain, specifically, how the code path for setting a specific numeric font size via inline style is slower than, say, setting the same attribute on an NSMutableAttributedString? (I know of one way in which it is slower, but it has nothing to do with anything discussed in this article and is fixable via work-in-progress specs.)

With native apps, you can either use the raw style modification methods or a comparatively slow third-party style system of your choosing. With the Web, you can either use inline styles (akin to the raw style modification) or a slower, but still relatively fast style system. I don't see any advantage for native apps here.

Re:Implementing Font-Size in Servo: An Unexpectedly Complex ... by vanderZwan on Friday August 11, 2017 @04:21PM (#14993800)
Why do you keep arguing something that I'm not even disagreeing with? And why are you not even engaging with my earlier statement that you're arguing a different thing altogether. If I'm wrong about that, then just explain to me why instead of trying to convince me of something I'm already agreeing with.

I mean, you're the expert working on Servo here, so you're better equipped to answer the other claim that you're ignoring: is a simpler spec than HTML and CSS be easier to optimise, yes or no?

Re:Implementing Font-Size in Servo: An Unexpectedly Complex ... by Manishearth on Friday August 11, 2017 @04:55PM (#14994169)
> If I'm wrong about that

You are wrong about that, and he did explain. He is talking about the same thing. That was the purpose of his comment about inline styles. (If it was unclear I can answer any more specific questions you have)

What native frameworks let you do is assign inline styling to mostly leaf nodes, plus some extremely generic overall theming functionality.

This is both possible and fast in CSS. This is not where CSS is complicated.

Comparing apples to apples, they're simple specs.

You're saying "But they cannot hope to be able to optimise as much and as easily as the former approach (in principle that is, I cannot say anything about whether or not they actually do)." -- this is incorrect. Setting inline style on leaf nodes is very fast and not a performance issue especially if you solely rely on inline style. The main reason I can think it would be a perf issue is that in CSS this will have to re-parse (whereas in native you can set these things without string ops), but that is fixable (typed CSSOM is probably going to happen). But aside from that, it's a simple computation followed by setting something on a struct. Not really a problem. You can't really optimize it further, aside from the typed CSSOM thing I mentioned (which has nothing to do with complexity).

CSS gets complicated when it attempts provides more power than these native frameworks, however the associated perf issues crop up when you try to use these features. If you use CSS restricted to the feature set of basic native frameworks, these complexities will not affect you much.

pcwalton made an additional point on top of that that if you want to compare apples to apples here, you get frameworks with that level of power (e.g. React Native) on the other side, which don't have as many optimizations.