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

Optimize ecovec![] macro #29

Merged
merged 1 commit into from
Aug 3, 2023
Merged

Commits on Aug 3, 2023

  1. Optimize ecovec![] macro

    LLVM is not smart enough to eliminate calls to `EcoVec::reserve()` even when
    they are unecessary thanks to earlier calls to `EcoVec::reserve()` or
    `EcoVec::with_capacity()`. This patch elimates them when the `ecovec![]` macro
    is used. There may be other unnecessary calls which can be elimated in future
    patches.
    
    `ecovec![1, 2, 3]` results in 3 unecessary calls to `EcoVec::reserve()`. Fixed
    by forwarding to the `From<[T; N]>` impl.
    
    `ecovec![1; 42]` results in 42 unecessary calls to `EcoVec::reserve()`. Fixed by
    adding `EcoVec::push_unchecked()` function for when we know resizing is
    unnecessary.
    Kmeakin committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    46537aa View commit details
    Browse the repository at this point in the history