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

Add let block around call to partialsort! to avoid overhead from captured variable #76

Closed
wants to merge 1 commit into from

Conversation

andreasnoack
Copy link
Member

@andreasnoack andreasnoack commented Aug 15, 2023

See #73 (comment) for some details. This isn't sufficient to make loess feasible for the dataset in #73 but it significantly speeds up the calculation. For a random subset with 10000 elements of the dataset from #73, I'm getting

julia> ft = @time loess(x, y);
  7.355545 seconds (357.20 M allocations: 5.519 GiB, 5.16% gc time)

with the current implementation and

julia> ft = @time loess(x, y);
  0.208809 seconds (10.97 k allocations: 200.746 MiB, 5.05% gc time)

with this PR.

Update: I've changed this to just use a let block instead the helper function. The performance impact is the same.

@andreasnoack andreasnoack changed the title Move the call to partialsort! to a separate function to avoid Add let block around call to partialsort! to avoid overhead from captured variable Aug 15, 2023
src/kd.jl Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.09% 🎉

Comparison is base (1b34e35) 89.90% compared to head (ad4252f) 90.00%.

❗ Current head ad4252f differs from pull request most recent head c5b65ec. Consider uploading reports for the commit c5b65ec to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   89.90%   90.00%   +0.09%     
==========================================
  Files           2        2              
  Lines         208      210       +2     
==========================================
+ Hits          187      189       +2     
  Misses         21       21              
Files Changed Coverage Δ
src/kd.jl 96.19% <100.00%> (+0.07%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@palday
Copy link
Member

palday commented Aug 22, 2023

@andreasnoack if you merge in master, there is now a benchmarking CI

@github-actions
Copy link

Benchmark Report for /home/runner/work/Loess.jl/Loess.jl

Job Properties

  • Time of benchmarks:
    • Target: 23 Aug 2023 - 19:45
    • Baseline: 23 Aug 2023 - 19:46
  • Package commits:
    • Target: 24c703
    • Baseline: 5126a7
  • Julia commits:
    • Target: e4ee48
    • Baseline: e4ee48
  • Julia command flags:
    • Target: None
    • Baseline: -Cnative,-J/opt/hostedtoolcache/julia/1.9.2/x64/lib/julia/sys.so,-g1,-O3,-e,using Pkg; Pkg.update()
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["random", "100"] 0.55 (5%) ✅ 0.96 (1%) ✅
["random", "1000"] 0.46 (5%) ✅ 0.70 (1%) ✅
["random", "10000"] 0.51 (5%) ✅ 0.47 (1%) ✅
["random", "100000"] 0.53 (5%) ✅ 0.43 (1%) ✅
["random", "1000000"] 0.57 (5%) ✅ 0.40 (1%) ✅
["ties", "sine"] 0.06 (5%) ✅ 0.05 (1%) ✅

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["random"]
  • ["ties"]

Julia versioninfo

Target

Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
      Ubuntu 22.04.3 LTS
  uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2593 MHz        600 s          0 s        150 s       2084 s          0 s
       #2  2593 MHz       1068 s          0 s        136 s       1596 s          0 s
  Memory: 6.7694854736328125 GB (5423.71875 MB free)
  Uptime: 288.49 sec
  Load Avg:  1.0  0.62  0.28
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512)
  Threads: 1 on 2 virtual cores

Baseline

Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
      Ubuntu 22.04.3 LTS
  uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2593 MHz       1405 s          0 s        176 s       2133 s          0 s
       #2  2593 MHz       1168 s          0 s        162 s       2348 s          0 s
  Memory: 6.7694854736328125 GB (5422.44140625 MB free)
  Uptime: 376.65 sec
  Load Avg:  1.11  0.78  0.37
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512)
  Threads: 1 on 2 virtual cores

@andreasnoack
Copy link
Member Author

Superseded by #74

@andreasnoack andreasnoack deleted the an/barrier branch August 25, 2023 11:42
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.

3 participants