Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace dynamic trait objects with static type parameters #40

Merged
merged 4 commits into from Mar 15, 2023

Conversation

mcevoypeter
Copy link

This PR replaces dynamic trait objects with static type parameters to eliminate the overhead of a vtable lookup at runtime. It does by requiring types implementing the NounAllocator or Stack traits also implement the Sized trait. This change does not result in an increase in binary size:

$ git checkout status
$ cargo build --release
$ du -sh target/release/libares.rlib
1.1M    target/release/libares.rlib

$ git checkout peter/remove-dyn
$ cargo build --release
$ du -sh target/release/libares.rlib
1.1M    target/release/libares.rlib

Copy link
Collaborator

@eamsden eamsden left a comment

Choose a reason for hiding this comment

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

Aside from separating formatting/semantic changes (de minimis in this case) this looks good.

rust/ares/src/noun.rs Outdated Show resolved Hide resolved
@eamsden
Copy link
Collaborator

eamsden commented Mar 15, 2023

@mcevoypeter go ahead and merge this

@mcevoypeter mcevoypeter merged commit 2a553a4 into status Mar 15, 2023
2 checks passed
@mcevoypeter mcevoypeter deleted the peter/remove-dyn branch March 15, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants