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

Reduce iterations in concatenate! #946

Merged
merged 1 commit into from
Jan 10, 2024

Commits on Jan 9, 2024

  1. Reduce iterations in concatenate!

    This commit should reduce the amount of iterations in concatenate to N
    where N is the sum of the lengths of the input lists.
    
    The previous implementation iterated from the beginning in each
    concatenation because of `last-pair`.
    
    This implementation is significantly faster in this extreme case:
    
    (concatenate! `(,(iota 50000) ,@(map list (iota 500))))
    
    >> Previous implementation:
    real	0m0.671s
    user	0m0.658s
    sys	0m0.013s
    
    >> This implementation:
    real	0m0.175s
    user	0m0.174s
    sys	0m0.001s
    
    The tests is done using `time`, which is not reliable at all, but using
    `(trace last-pair)` shows accurately what happens with the iterations.
    ekaitz-zarraga committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    967b888 View commit details
    Browse the repository at this point in the history