Skip to content

Conversation

@Moelf
Copy link
Owner

@Moelf Moelf commented Jul 4, 2025

The timing is distribution dependent

julia> @benchmark Hist1D(x; binedges=range(-1,1;length=11)) setup=x=rand(10^6)
BenchmarkTools.Trial: 1621 samples with 1 evaluation.
 Range (min  max):  1.418 ms    2.619 ms  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     1.803 ms               ┊ GC (median):    0.00%
 Time  (mean ± σ):   1.814 ms ± 136.134 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

                    ▂▃▂▂▆▇▄▆▆███▆▄▇▆▆▃▆▃▃▄▂▃▁▂▁
  ▂▂▂▂▃▁▁▂▃▂▄▄▄▄▄▆▇████████████████████████████▆▇▆▆▅▅▅▅▆▅▄▄▂▂ ▆
  1.42 ms         Histogram: frequency by time        2.14 ms <

 Memory estimate: 592 bytes, allocs estimate: 8.

julia> @benchmark Hist1D(x; binedges=range(-1,1;length=11)) setup=x=randn(10^6)
BenchmarkTools.Trial: 710 samples with 1 evaluation.
 Range (min  max):  5.025 ms   5.351 ms  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     5.133 ms              ┊ GC (median):    0.00%
 Time  (mean ± σ):   5.136 ms ± 46.322 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

                 ▃ ▃▂▃ ▄▁▃▂█▅▃▅▆▄▂▃  ▅▁
  ▃▁▂▃▃▃▁▅▅▄▆▅▆▅▇█▇████████████████▇▇██▆▆▅▅▆▇▄▄▆▅▃▃▃▂▃▄▄▃▃▃▂ ▅
  5.03 ms        Histogram: frequency by time        5.26 ms <

 Memory estimate: 592 bytes, allocs estimate: 8.
In [1]: import numpy as np

In [2]: x = np.random.random(10**6)

In [3]: %timeit np.histogram(x, bins=10, range=(-1, 1))
6.13 ms ± 66.7 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [4]: x = np.random.normal(size=10**6)

In [5]: %timeit np.histogram(x, bins=10, range=(-1, 1))
8.09 ms ± 30.9 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)

@codecov
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.96%. Comparing base (8e7b460) to head (4cbadd9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
- Coverage   76.99%   76.96%   -0.03%     
==========================================
  Files          11       11              
  Lines         826      825       -1     
==========================================
- Hits          636      635       -1     
  Misses        190      190              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2025

Benchmark Results (Julia v1)

Time benchmarks
main 4cbadd9... main / 4cbadd9...
Non-Uniform Binning/One-shot Gaussian input 17.4 ± 0.086 ms 17.5 ± 0.074 ms 0.997 ± 0.0065
Non-Uniform Binning/One-shot Gaussian input with weights 18.4 ± 0.084 ms 18.1 ± 0.068 ms 1.02 ± 0.0061
Non-Uniform Binning/One-shot Uniform input 16.7 ± 0.071 ms 16.6 ± 0.13 ms 1.01 ± 0.009
Non-Uniform Binning/One-shot Uniform input with weights 17.9 ± 0.073 ms 17.6 ± 0.086 ms 1.02 ± 0.0065
Uniform Binning/One-shot Gaussian input 7.34 ± 0.052 ms 7.29 ± 0.03 ms 1.01 ± 0.0082
Uniform Binning/One-shot Gaussian input with weights 11.2 ± 0.038 ms 11.1 ± 0.052 ms 1.02 ± 0.0059
Uniform Binning/One-shot Uniform input 1.72 ± 0.0093 ms 1.72 ± 0.009 ms 1 ± 0.0075
Uniform Binning/One-shot Uniform input with weights 8.19 ± 0.025 ms 8.16 ± 0.025 ms 1 ± 0.0043
Uniform Binning/atomic_push!-loop Gaussian input 12 ± 0.057 ms 12.4 ± 0.032 ms 0.97 ± 0.0052
Uniform Binning/push!-loop Uniform input 2.03 ± 0.015 ms 2.06 ± 0.012 ms 0.988 ± 0.0091
time_to_load 0.295 ± 0.00095 s 0.298 ± 0.0039 s 0.989 ± 0.013
Memory benchmarks
main 4cbadd9... main / 4cbadd9...
Non-Uniform Binning/One-shot Gaussian input 11 allocs: 0.469 kB 11 allocs: 0.469 kB 1
Non-Uniform Binning/One-shot Gaussian input with weights 11 allocs: 0.469 kB 11 allocs: 0.469 kB 1
Non-Uniform Binning/One-shot Uniform input 11 allocs: 0.469 kB 11 allocs: 0.469 kB 1
Non-Uniform Binning/One-shot Uniform input with weights 11 allocs: 0.469 kB 11 allocs: 0.469 kB 1
Uniform Binning/One-shot Gaussian input 10 allocs: 0.547 kB 10 allocs: 0.547 kB 1
Uniform Binning/One-shot Gaussian input with weights 10 allocs: 0.547 kB 10 allocs: 0.547 kB 1
Uniform Binning/One-shot Uniform input 10 allocs: 0.547 kB 10 allocs: 0.547 kB 1
Uniform Binning/One-shot Uniform input with weights 10 allocs: 0.547 kB 10 allocs: 0.547 kB 1
Uniform Binning/atomic_push!-loop Gaussian input 7 allocs: 0.344 kB 7 allocs: 0.344 kB 1
Uniform Binning/push!-loop Uniform input 7 allocs: 0.344 kB 7 allocs: 0.344 kB 1
time_to_load 0.159 k allocs: 11.2 kB 0.159 k allocs: 11.2 kB 1

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