The default HTTP session is exempt from --http-session-timeout, and its
page keeps being pumped while idle. A script-heavy page left there holds a
core for as long as the process runs.
When the default session has been idle for the timeout, close its pages
and trim. The session stays, with its cookies: reaping it would have a
fresh one overwrite the --cookie-jar file on exit.
HttpServer.init takes the timeout as a parameter, since the default
worker now reads it from its first iteration.
None of the NodeList variants can fail, but length returned !u32 and
getAtIndex !?*Node. An error union comes back through memory as two
stores read by one wider load, which can't be store-forwarded. u32 and
?*Node come back in a register.
Drops the unused error union from ChildNodes, RadioNodeList,
selector.List and HTMLFormControlsCollection.iterator too, and the try
at each caller.
Refs #349
The identity key is the start of the chain allocation, which most levels
of the chain compute the same as the leaf. Look the instance up at the
first such level, so a hit skips the walk down to the most specific type.
A type that a direct subtype embeds by value as its _proto (EventTarget
inside Node) doesn't sit at the start of the allocation; keyIsChainRoot
detects that at compile time and the lookup moves one level down. In
debug builds wrapLeaf asserts that the slot found higher up is its own.
Refs #349
Adds better "display: grid" support, including some basic support for various
grid-related styles.
Also improve text wrapping to use the computed width, not just an explicit width
attribute.
Comes with a new grid-specific perf scenario (merged): https://github.com/lightpanda-io/demo/pull/316
While this adds a handful of grid-specific optimization, but it's the more
general improvements in 1.0.4 and #4651 which make this faster:
```
scenario bin work Mins Δ% task ms wall ms Δ% rss MB Δ% reqs
style 1.0.3 290.6 +0.00% 61 340 +0.0% 36.2 +0.0% 4
style dev 268.8 -7.50% 64 343 +0.9% 42.3 +16.9% 4
layout 1.0.3 12303.1 +0.00% 562 760 +0.0% 39.6 +0.0% 4
layout dev 1816.0 -85.24% 126 323 -57.5% 45.3 +14.3% 4
hittest 1.0.3 2212.1 +0.00% 154 170 +0.0% 36.1 +0.0% 4
hittest dev 2138.0 -3.35% 161 183 +7.9% 43.3 +20.1% 4
gbcr 1.0.3 12952.1 +0.00% 681 658 +0.0% 59.2 +0.0% 4
gbcr dev 1013.6 -92.17% 112 89 -86.5% 59.4 +0.2% 4
grid 1.0.3 20076.0 +0.00% 1125 1102 +0.0% 60.0 +0.0% 4
grid dev 1305.5 -93.50% 130 108 -90.2% 57.1 -4.9% 4
render 1.0.3 710.7 +0.00% 145 575 +0.0% 39.3 +0.0% 4
render dev 699.6 -1.56% 145 571 -0.7% 46.3 +18.0% 4
```
Issue reportd / worked around here: https://github.com/fastcrw/crw/pull/749
When RI loads the transfer (to continue / fulfill / fail), we need to make sure
the transfer isn't in an aborted state.
This adds a --v8-gc-floor-mb flag and sets it to 32MiB. The old behavior, v8
default, is that it starts at 32MiB (same) but after each full GC, it lowers
the limit to at least what survived + 8MiB.
This is essentially a mem vs cpu flag similar to `--v8-gc-hint-floor-mb` (PR
`Isolate::MemoryPressureNotification`. This new flag is v8's own floor, under
which it does not start a full GC by itself.
The frames scenario with `--v8-gc-floor-mb 32` (new default) vs
`--v8-gc-floor-mb 0` (old default) shows the new default requiring ~28% fewer
instructions (because it runs fewer GCs)
When --load-resources stylesheet this commit now hooks into the existing preload
to eagerly begin downloading external stylesheets.
This is meant as a replacement for #4565. It's a simpler implementation that
also provides the parallel benefit in more cases.
waiting for the download to complete. So, given:
```html
<link href="blah1.css">
<div></div>
<script>...</script>
<link href="blah2.css">
```
This commit is starts both blah1 and blah2 early, where 4565 processes one
at a time.
Add a single flow role helper that can answer display none, out of flow, block,
or on the line. This removes some overhead of getting each property one at a
time.
Also, viewport change now bumps the layout memo, which makes checking for a
viewport change cheaper.
A parser append use to be treated as a full style wipe (largely, to keep parser
appends fast). Some parser appends now go through the same flow as a appendChild
and selectively clear cached results
Using a side record, store the full vertical band, including the subtree, of
an element. This allows the hit test to skip full trees, where the element's
record vertical band doesn't contain y. This restores _some_ of the hit test
optimization that was possible with the naive l
change expands that to be more selective about the layout memo.
Style memo was largely about how a change to el can reach its tree. Layout
memo is more about knowing what up from el needs to be changed (e.g. a child
gets wider).
On a cache miss, boxOffset now walks backwards to the nearest sibling that has
a cached value instead of walking forward from the parent's first child.
Improves https://github.com/lightpanda-io/browser/issues/4576
The gbcr scenario was +139% work compared to 1.0.4 before this change and is now
at -41.14%.
A RecvError after the headers was taken as a normal end of body whenever
the response had no Connection header (or Connection: close). That is
right for a close-delimited body, where a TLS peer closing without
close_notify ends it, but a body framed by Content-Length or chunked
encoding has its own end: losing the connection before it means the
response was truncated. fetch() and XHR resolved such responses as
complete, with whatever part had arrived, and a malformed chunked body
loaded as an empty 200.
Stacked on https://github.com/lightpanda-io/browser/pull/4549
Where 4549 was part performance part feature, this closes the feature gap by
adding support for absolute and relative position boxes. Unfortunately, it makes
performance worse: hit testing no longer has an early exit since nodes can now
be positioned anywhere (with the simple layout, once el.y > target_y, we could
exit the loop, now a later element can appear above or at the target).
Giving a more accurate top/height is easy. What isn't easy is making it fast.
We cache a lot, and a lot of code busts the cache. This is particularly true
for height/top, where just looking at the site is almost enough to invalidate
every cached layout/computed value.
https://github.com/lightpanda-io/browser/pull/4445 was the first commit to try
to add more narrow invalidation.
But height/top are _so_ sensitive that virtually any change, that height/top
specific optimizations are needed. The short version is that: without better
targeting, changes to an element invalidates every following element (in tree
order).
```
<div id=a>a</div>
<div id=b>b</div>
---
|a|
---
|b|
---
```
change the height of #a, and the top of b, all its children and anything in
tree order after it has a new top. And if #a changes height, maybe its parent
also changes height...and before long, the entire layout cache is trashed.
This commit adds the first specialized invalidation protection for explicit
height changes. The main change is that, rather than caching the absolute top
(which, as explained above, is constantly broken by changes), we cache the
offset relative to the parent. Relative offsets to parents are far more stable.
The only things that become invalid are essentially the elements next siblings.
Top becomes more expensive (adding all ancestor offsets), but that's a small
price to pay.
WIP: because there are other common patterns that still trash the cache. And
those need to be addressed, at least to some degree, before the better top/
height can be used.
This commit adds very specific selective invalidation protection for explicitly
setting a height (e.g. el.style.height = '...') which is relative common and
extremely destructive to the cache without optimization.
Next.js App Router with `cacheComponents: true` tees the Flight stream
during hydration. Without tee() the page throws `I.tee is not a function`
and React never mounts (#4654).
tee() follows ReadableStreamDefaultTee: it locks the source and each
branch pulls one chunk at a time, so the source isn't drained ahead of
the branches. Both branches get the same chunk (no clone). Cancelling one
branch leaves the other flowing; the source is cancelled once both are,
with [reason1, reason2]. Only a locked stream throws; a closed or errored
source yields closed or errored branches.
values() returns the existing async iterator, which now also returns
itself from [Symbol.asyncIterator] so `for await (... of s.values())`
works.