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

PolynomialEvaluationArrays #4

Merged
merged 4 commits into from
Sep 25, 2017
Merged

PolynomialEvaluationArrays #4

merged 4 commits into from
Sep 25, 2017

Conversation

saschatimme
Copy link
Collaborator

@saschatimme saschatimme commented Sep 22, 2017

This introduces a new type PolynomialEvaluationArray. The idea is to extend the previous performance improvements to arrays of polynomials.
The implementation is quite straightforward:

  • Find all occurring exponents
  • Build up lookup tables for each polynomial
  • Use a Horner schema to compute all values x[i]^k <-- here are the improvements
  • Use the compute values to evaluate the polynomials

To achieve this I also modified the previous implementation for a single polynomial and improved the performance even more:

x + y + 1
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     19.861 ns (0.00% GC)
  median time:      20.354 ns (0.00% GC)
  mean time:        25.981 ns (0.00% GC)
  maximum time:     26.923 μs (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     995

x^4 + 4x^3 + 6x^2 + 4x + y + 1
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     29.354 ns (0.00% GC)
  median time:      29.726 ns (0.00% GC)
  mean time:        32.476 ns (0.00% GC)
  maximum time:     213.355 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     994

50x^3 + 83x^2y + 24xy^2 + y^3 + 392x^2 + 414xy + 50y^2 - 28x + 59y - 100
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     35.406 ns (0.00% GC)
  median time:      38.362 ns (0.00% GC)
  mean time:        41.891 ns (0.00% GC)
  maximum time:     665.141 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     992

x^4y^2 + 10x^3y^2 + 3x^3y + 15x^2y^2 + xy^3 + 10x^2y + 10xy^2 + x^2 + 10xy + x + y
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     39.339 ns (0.00% GC)
  median time:      41.795 ns (0.00% GC)
  mean time:        43.575 ns (0.00% GC)
  maximum time:     175.543 ns (0.00% GC)
  --------------
  samples:          10000

I think the main reason that the performance is improved is that branch prediction is more successful than previously.

@codecov
Copy link

codecov bot commented Sep 22, 2017

Codecov Report

Merging #4 into master will decrease coverage by 6.83%.
The diff coverage is 71.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #4      +/-   ##
==========================================
- Coverage   94.62%   87.79%   -6.84%     
==========================================
  Files           3        5       +2     
  Lines         242      295      +53     
==========================================
+ Hits          229      259      +30     
- Misses         13       36      +23
Impacted Files Coverage Δ
src/polynomialarray.jl 0% <0%> (ø)
src/poly.jl 96.37% <100%> (-0.5%) ⬇️
src/precomputation.jl 98.11% <98.11%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 426d553...64cb1f9. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 22, 2017

Codecov Report

Merging #4 into master will increase coverage by 0.98%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #4      +/-   ##
=========================================
+ Coverage   94.62%   95.6%   +0.98%     
=========================================
  Files           3       5       +2     
  Lines         242     296      +54     
=========================================
+ Hits          229     283      +54     
  Misses         13      13
Impacted Files Coverage Δ
src/precomputation.jl 100% <100%> (ø)
src/poly.jl 96.37% <100%> (-0.5%) ⬇️
src/polynomialarray.jl 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 426d553...c9f2e4a. Read the comment docs.

@saschatimme saschatimme changed the title Polynomialarrays PolynomialEvaluationArrays Sep 25, 2017
@saschatimme saschatimme merged commit cb850a1 into master Sep 25, 2017
@saschatimme saschatimme deleted the polynomialarrays branch November 1, 2017 19:57
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