Conversation
use searchsortedfirst (since the arrays are small it doesn't really make a performance difference but w/e)
I think they were failing because LLVM.jl was emitting deprecation warnings which triggered @test_nowarn
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
==========================================
+ Coverage 91.78% 93.44% +1.66%
==========================================
Files 4 4
Lines 292 305 +13
==========================================
+ Hits 268 285 +17
+ Misses 24 20 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR strengthens the robustness and performance of the IMF distributions (notably BrokenPowerLaw and LogNormalBPL) by enforcing sorted breakpoints (required for binary search), hardening cumulative integral normalization used by quantile/rand, and adding a benchmarking setup to track performance over time.
Changes:
- Enforce sorted
breakpointsinBrokenPowerLawandLogNormalBPL, and switch several index lookups fromfindfirsttosearchsortedfirst. - Harden cumulative
integralsby forcing the final cumulative value to1and add tests asserting normalization and boundary quantile behavior. - Add a benchmark project + suite + GitHub Actions workflow to run PR benchmarks.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/powerlaw.jl |
Require sorted breakpoints; use searchsortedfirst; force integrals[end] = 1 for robustness. |
src/lognormal.jl |
Require sorted breakpoints; optimize pdf/logpdf indexing; force integrals[end] = 1; use first/last for min/max. |
test/runtests.jl |
Add tests for sorted breakpoint assertions, integral normalization, and quantile boundary behavior. |
test/allocations_tests.jl |
Remove @test_nowarn wrappers around allocation checks. |
Project.toml |
Add a workspace definition including benchmark. |
benchmark/Project.toml |
Add benchmark environment dependencies. |
benchmark/benchmarks.jl |
Add benchmark suite for BrokenPowerLaw and LogNormalBPL + pretty summary output. |
.github/workflows/benchmark.yml |
Add PR benchmark workflow using AirspeedVelocity.jl action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.