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

Optimise multiplication #295

Merged
merged 4 commits into from Apr 24, 2024
Merged

Optimise multiplication #295

merged 4 commits into from Apr 24, 2024

Commits on Apr 16, 2024

  1. Add two new multiply benchmarks testing large factors of unequal sizes

    test multiply_0           ... bench:          42 ns/iter (+/- 0)
    test multiply_1           ... bench:       4,271 ns/iter (+/- 68)
    test multiply_2           ... bench:     289,339 ns/iter (+/- 10,532)
    test multiply_3           ... bench:     663,387 ns/iter (+/- 17,381)
    test multiply_4           ... bench:       7,474 ns/iter (+/- 384)
    test multiply_5           ... bench:      16,376 ns/iter (+/- 254)
    joelonsql committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    788b170 View commit details
    Browse the repository at this point in the history
  2. Implement Half-Karatsuba for unequal factor sizes

    Introduces Half-Karatsuba in multiplication module for cases where there is a
    significant size disparity between factors. Optimizes performance by evenly
    splitting the larger factor for more balanced multiplication calculations.
    
    -test multiply_0           ... bench:          42 ns/iter (+/- 0)
    +test multiply_0           ... bench:          42 ns/iter (+/- 0)
    
    -test multiply_1           ... bench:       4,271 ns/iter (+/- 68)
    +test multiply_1           ... bench:       4,242 ns/iter (+/- 164)
    
    -test multiply_2           ... bench:     289,339 ns/iter (+/- 10,532)
    +test multiply_2           ... bench:     288,857 ns/iter (+/- 8,715)
    
    -test multiply_3           ... bench:     663,387 ns/iter (+/- 17,381)
    +test multiply_3           ... bench:     583,635 ns/iter (+/- 14,997)
    
    -test multiply_4           ... bench:       7,474 ns/iter (+/- 384)
    +test multiply_4           ... bench:       6,649 ns/iter (+/- 164)
    
    -test multiply_5           ... bench:      16,376 ns/iter (+/- 254)
    +test multiply_5           ... bench:      13,922 ns/iter (+/- 323)
    joelonsql committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    bdfe165 View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2024

  1. Simplify further by eliminating p to avoid allocation

    Per suggestion from cuviper
    joelonsql committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    5ff5164 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aea9284 View commit details
    Browse the repository at this point in the history