Skip to content

remove unneeded clone in TzdbResolver::get#628

Merged
nekevss merged 1 commit intoboa-dev:mainfrom
Sharktheone:remove-unneeded-clones
Nov 18, 2025
Merged

remove unneeded clone in TzdbResolver::get#628
nekevss merged 1 commit intoboa-dev:mainfrom
Sharktheone:remove-unneeded-clones

Conversation

@Sharktheone
Copy link
Copy Markdown
Contributor

I noticed that every time when a timezone is accessed via ResolvedId in the cache, the full Tzif struct is cloned, which contains multiple allocations.

Just from poking around in the code, this seems to happen quite frequently, for example when a new ZonedDateTime is created.

In the future the dx can be improved once RwLockReadGuard::map is stabilized, see rust-lang/rust#117108, though I think it will take some time.

Comment thread provider/src/tzif.rs Outdated
@Sharktheone Sharktheone force-pushed the remove-unneeded-clones branch from 1cb021a to 9947d18 Compare November 18, 2025 07:17
@Sharktheone Sharktheone requested a review from nekevss November 18, 2025 07:19
Copy link
Copy Markdown
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

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

Looks generally good to me! Thanks for the PR, and sorry for the late review!

This just needs a rebase or merge to update the branch, then it can be merged.

in the future the dx can be improved once `RwLockReadGuard::map` is stabilized, see rust-lang/rust#117108
@Sharktheone Sharktheone force-pushed the remove-unneeded-clones branch from 9947d18 to 281c22d Compare November 18, 2025 17:27
@Sharktheone
Copy link
Copy Markdown
Contributor Author

This just needs a rebase or merge to update the branch, then it can be merged.

Ah, yeah... somehow missed that. Sorry

@nekevss
Copy link
Copy Markdown
Member

nekevss commented Nov 18, 2025

Ah, yeah... somehow missed that. Sorry

Don't worry it happens after just about every merge to main

@nekevss nekevss merged commit c0d0101 into boa-dev:main Nov 18, 2025
8 checks passed
@Sharktheone Sharktheone deleted the remove-unneeded-clones branch November 18, 2025 20:17
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.

2 participants