-
Notifications
You must be signed in to change notification settings - Fork 21
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
change API to specify field assumptions at unpack callsite instead of globally #39
Conversation
sooooooo this definitely results in a performance hit; I'm messing around with a type that looks like: on master:
this PR:
where
(and The API here is so much nicer (IMO) that I'm tempted to accept the performance hit...I'd bet that some additional optimization can be done to further recover performance for at least the |
Okay, did another round of benchmarking; link to gist here. It turns out that the fast path overhead for this PR compared to master is actually negligible as long as the types being passed in are inferred as constants! This is great: essentially, there's no performance loss compared to master for the situation that master currently supports (globally assuming a given type should be parsed strictly). The mutable path is still a bit slower, but I feel more comfortable with being able to recover that performance back later without too much API hassle (even if it just means reintroducing master's current implementation, for those folks that absolutely need that level of performance). Now that I'm happy enough with the performance situation, I'll crank away on the docs/depwarns to get this merged. |
initial attempt at addressing #35. still needs:
ImmutableStructType
/MutableStructType
I realized that there are more assumptions at play here than just ordering; I couldn't think of a succinct term that precisely captures them all, though, so I just use the vague
Exact{T}
- open to better names if folks have ideas! EDIT: @ararslan used the word "strict" here which I kind of like