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

New evaluation routine #1

Merged
merged 3 commits into from
Sep 18, 2017
Merged

New evaluation routine #1

merged 3 commits into from
Sep 18, 2017

Conversation

saschatimme
Copy link
Collaborator

This new evaluation algorithm increases the memory footprint of a FixedPolynomial but for this we get performance increases with a factor of up to 7 (and probably even more for polynomials with higher degrees).

Here are the detailed benchmark results from the committed benchmark/evaluation.jl:
master

x + y + 1
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     84.496 ns (0.00% GC)
  median time:      86.308 ns (0.00% GC)
  mean time:        91.803 ns (0.00% GC)
  maximum time:     244.586 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     962

x^4 + 4x^3 + 6x^2 + 4x + y + 1
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     174.762 ns (0.00% GC)
  median time:      181.137 ns (0.00% GC)
  mean time:        191.230 ns (0.00% GC)
  maximum time:     472.054 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     723

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:     350.547 ns (0.00% GC)
  median time:      363.752 ns (0.00% GC)
  mean time:        386.236 ns (0.00% GC)
  maximum time:     11.714 μs (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     214

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:     474.281 ns (0.00% GC)
  median time:      491.551 ns (0.00% GC)
  mean time:        530.601 ns (0.00% GC)
  maximum time:     1.745 μs (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     196

this branch

  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     30.199 ns (0.00% GC)
  median time:      30.317 ns (0.00% GC)
  mean time:        33.423 ns (0.00% GC)
  maximum time:     822.494 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     994

x^4 + 4x^3 + 6x^2 + 4x + y + 1
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     41.132 ns (0.00% GC)
  median time:      44.613 ns (0.00% GC)
  mean time:        47.831 ns (0.00% GC)
  maximum time:     580.027 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     990

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:     57.427 ns (0.00% GC)
  median time:      57.682 ns (0.00% GC)
  mean time:        63.204 ns (0.00% GC)
  maximum time:     348.563 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     983

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:     61.178 ns (0.00% GC)
  median time:      65.876 ns (0.00% GC)
  mean time:        83.605 ns (0.00% GC)
  maximum time:     10.336 μs (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     981

@codecov
Copy link

codecov bot commented Sep 18, 2017

Codecov Report

Merging #1 into master will increase coverage by 0.36%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #1      +/-   ##
==========================================
+ Coverage   94.17%   94.53%   +0.36%     
==========================================
  Files           3        3              
  Lines         223      238      +15     
==========================================
+ Hits          210      225      +15     
  Misses         13       13
Impacted Files Coverage Δ
src/poly.jl 96.79% <100%> (+0.34%) ⬆️

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 703371f...a5ec57d. Read the comment docs.

@blegat
Copy link
Member

blegat commented Sep 18, 2017

Do you think that the implementation of the evaluation in DynamicPolynomials could be improved ?

@saschatimme
Copy link
Collaborator Author

I don't think so (at least I don't see an obvious way to improve things).

This new algorithm relies heavily on these precomputations which I would have to be recomputed for each new polynomial. So I think we cannot have the cake and eat it too :/

@saschatimme saschatimme merged commit 14a0461 into master Sep 18, 2017
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.

None yet

2 participants