Skip to content

Optimisations#1133

Merged
epage merged 2 commits intotoml-rs:mainfrom
dimbleby:micro-optimisations
Mar 31, 2026
Merged

Optimisations#1133
epage merged 2 commits intotoml-rs:mainfrom
dimbleby:micro-optimisations

Conversation

@dimbleby
Copy link
Copy Markdown
Contributor

@dimbleby dimbleby commented Mar 30, 2026

A couple of small optimisations:

  • avoid unnecessary path cloning in get_values()
  • avoid needlessly collecting one already-owned Vec into another

The second seems easy, the first is maybe a little bit on the clever side for modest gain.

If you want both, or neither, thats easy: merge or reject. If you want one but not the other let me know.

@dimbleby dimbleby force-pushed the micro-optimisations branch 2 times, most recently from eb37e26 to 1be22da Compare March 30, 2026 10:26
@dimbleby dimbleby force-pushed the micro-optimisations branch from 1be22da to 4de79db Compare March 30, 2026 23:37
dimbleby and others added 2 commits March 31, 2026 16:36
Use push/pop on a shared Vec instead of cloning the parent path for every child in append_values() and append_all_values(). Paths are now only cloned when storing leaf values in the result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
values.values is already a Vec<Item>, so into_iter().collect::<Vec<_>>() just copies it needlessly. Use the owned Vec directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dimbleby dimbleby force-pushed the micro-optimisations branch from 7cb7719 to b8578fa Compare March 31, 2026 15:37
@epage
Copy link
Copy Markdown
Member

epage commented Mar 31, 2026

Thanks!

@epage epage merged commit c11d7d7 into toml-rs:main Mar 31, 2026
15 checks passed
@dimbleby dimbleby deleted the micro-optimisations branch March 31, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants