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

Speed up reflection and row operations #23

Merged
merged 1 commit into from
Jul 11, 2024
Merged

Speed up reflection and row operations #23

merged 1 commit into from
Jul 11, 2024

Conversation

mcy
Copy link
Owner

@mcy mcy commented Jul 11, 2024

Building reflection for types that have a lot of field tags is currently pretty slow. After this patch it will still be slow, but a lot of unnecessary work has been removed. In particular, best::row::apply is now implemented directly as a primitive in best::row_internal::impl, which means each call does not slam best::row::get N times.

Profiling suggests a lot of time is wasted instantiating copies of best::tlist; that may be a worthwhile target for optimizing down the line (either by making instantiation cheaper or reducing the number of instantiations; it looks like it's currently linear-ish but there are almost certainly avoidable quadratic instantiations lurking).

Additionally, this change fixes bugs in best::vec, best::overflow, and best::atoi that this optimization refactor uncovered, and introduces best::iter::take(), which I needed for debugging one of the bugs. It also adds the best::abridged concept for detecting whether a type is a best::abridged<T>.

@mcy mcy merged commit c0e02c1 into main Jul 11, 2024
2 checks passed
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