Repository navigation
Do not set a default which the struct already holds - #29
Merged
Merged
Conversation
…ng made: and make the crate 1.3.0
…-tag Take the crate's version from the tag when it is released
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Making an object with many defaults is quicker: a field which is given its default is no longer set, as the struct which is generated already holds it.
On an Apple M1, of extensions built for release, in nanoseconds:
Trade, of 19 fields, 14 of them defaultsMoney, of 2Customer, of 5How
default_factory. One held by reference is not skipped, unless it is None or holds nothing.With what is already built
An extension built by 1.2.0 works with this runtime, and one built by this with the runtime of 1.2.0: neither then skips.
Also
The crate is 1.3.0, as its source has changed, and the README's Performance tables are of a new run.
Tested, for C++ and for Rust: a field of an object which is not frozen, set to another value and back to its default; and a class of another default than its extension was built with, which has its own. The tests which are for every mode pass as before. Checked by hand: of 1,650 values given to the fields of four classes, each is taken or refused as before, and alike by C++ and Rust.