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

Implement faster gridmake #104

Merged
merged 1 commit into from
Mar 27, 2016
Merged

Implement faster gridmake #104

merged 1 commit into from
Mar 27, 2016

Conversation

sglyon
Copy link
Member

@sglyon sglyon commented Mar 26, 2016

Minor PR to implement a faster version of gridmake as well as implement a mutating version.

Also added some tests.

NOTE: this is breaking because previously we had the first array varying the fastest, now we have the last array varying the fastest. I don't believe this should cause problems for anyone, but if it does let me know and we'll do the other implementation.


A quick benchmark comparison:

julia> a1, a2, a3 = randn(10), randn(10), randn(10);

julia> @benchmark gridmake1(a1, a2, a3)
Benchmarks.ExecutionResults:
  samples:                          (see :samples field)
  precompiled?:                     true
  multiple evaluations per sample?: false
  total time spent benchmarking:    0.48 s
  Benchmarks.SummaryStats:
    estimated time per evaluation: 4.25 ms [3.34 ms, 5.17 ms]
    R² of OLS model:               N/A (OLS not performed)
    estimated % time in GC:        1.96 % [0.0 %, 7.9 %]
    bytes allocated:               819.83 kb
    number of allocations:         25104
    number of samples:             100
    number of evaluations:         100

julia> @benchmark gridmake(a1, a2, a3)
Benchmarks.ExecutionResults:
  samples:                          (see :samples field)
  precompiled?:                     true
  multiple evaluations per sample?: true
  total time spent benchmarking:    10.77 s
  Benchmarks.SummaryStats:
    estimated time per evaluation: 16.13 μs [15.73 μs, 16.52 μs]
    R² of OLS model:               0.91
    estimated % time in GC:        5.52 % [4.3 %, 6.74 %]
    bytes allocated:               26.61 kb
    number of allocations:         71
    number of samples:             6101
    number of evaluations:         670901

Here gridmake is the new version and gridmake1 is the old version. This scales better and better the larger the input arrays.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 92.851% when pulling 9de1930 on sl/gridmake into 1d6a083 on master.

@sglyon sglyon merged commit 39874eb into master Mar 27, 2016
@sglyon sglyon deleted the sl/gridmake branch November 7, 2016 13:55
@albop albop mentioned this pull request Nov 21, 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.

2 participants