Skip to content

Unmarshal directly during iteration to reduce intermediate slices#357

Draft
nickgarlis wants to merge 1 commit intogoogle:mainfrom
nickgarlis:unmarshal-during-iteration
Draft

Unmarshal directly during iteration to reduce intermediate slices#357
nickgarlis wants to merge 1 commit intogoogle:mainfrom
nickgarlis:unmarshal-during-iteration

Conversation

@nickgarlis
Copy link
Contributor

Currently, listing many rules or set elements generates a lot of intermediate slices, which increases memory usage unnecessarily.

This change unmarshals elements during iteration, avoiding these intermediate allocations. Benchmarks show improved performance, particularly when reading rules.

Depends on: mdlayher/netlink#258

I am opening this PR to kick off a discussion on whether this could be useful in practice.

cc @aojea

Currently, listing many rules or set elements generates a lot of
intermediate slices, which increases memory usage unnecessarily.

This change unmarshals elements during iteration, avoiding these
intermediate allocations. Benchmarks show improved performance,
particularly when reading rules.

Depends on: mdlayher/netlink#258
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.

1 participant