Skip to content

net: Instead of Duration use ApproxDuration - #47541

Merged
jdm merged 2 commits into
servo:mainfrom
Narfinger:duration-to-approx
Aug 26, 2026
Merged

jdm merged 2 commits into
servo:mainfrom
Narfinger:duration-to-approx

Conversation

@Narfinger

@Narfinger Narfinger commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

This changes the Duration in CachedResources to ApproxDuration.
This saves us a couple of bytes per CachedResources as ApproxDuration only stores the seconds (and Duration has nanosecond precision).

This adds up and on a simple load of thomann.de we go from 13.95MiB for the cache to 13.93MiB. For more browsing this gap will only get better.
The spec only cares about second precision.

Testing: As the spec only cares about seconds precision and we never used nanosecond precision, the nanosecond Duration part was always zero. Hence, this should not have any effects.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 26, 2026
@mrobinson

Copy link
Copy Markdown
Member

"13.93MiB for the cache to 13.93MiB." did you mean to write something else here?

@Narfinger

Copy link
Copy Markdown
Contributor Author

Fixed.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Aug 26, 2026
@jdm
jdm added this pull request to the merge queue Aug 26, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 26, 2026
Merged via the queue into servo:main with commit b562498 Aug 26, 2026
33 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 26, 2026
@Narfinger
Narfinger deleted the duration-to-approx branch August 27, 2026 07:16
RichardTjokroutomo pushed a commit to RichardTjokroutomo/servo that referenced this pull request Oct 6, 2026
This changes the Duration in CachedResources to ApproxDuration.
This saves us a couple of bytes per CachedResources as ApproxDuration
only stores the seconds (and Duration has nanosecond precision).

This adds up and on a simple load of thomann.de we go from 13.95MiB for
the cache to 13.93MiB. For more browsing this gap will only get better.
The spec only cares about second precision.

Testing: As the spec only cares about seconds precision and we never
used nanosecond precision, the nanosecond Duration part was always zero.
Hence, this should not have any effects.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Psychpsyo pushed a commit to Psychpsyo/servo that referenced this pull request Oct 12, 2026
This changes the Duration in CachedResources to ApproxDuration.
This saves us a couple of bytes per CachedResources as ApproxDuration
only stores the seconds (and Duration has nanosecond precision).

This adds up and on a simple load of thomann.de we go from 13.95MiB for
the cache to 13.93MiB. For more browsing this gap will only get better.
The spec only cares about second precision.

Testing: As the spec only cares about seconds precision and we never
used nanosecond precision, the nanosecond Duration part was always zero.
Hence, this should not have any effects.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants