-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Aug 23, 2024
1 parent
dc723d4
commit b7c3ffd
Showing
21 changed files
with
692 additions
and
514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-31T01:35:09","documenter_version":"1.5.0"}} | ||
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-23T03:17:17","documenter_version":"1.6.0"}} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Benchmarks · Peaks</title><meta name="title" content="Benchmarks · Peaks"/><meta property="og:title" content="Benchmarks · Peaks"/><meta property="twitter:title" content="Benchmarks · Peaks"/><meta name="description" content="Documentation for Peaks."/><meta property="og:description" content="Documentation for Peaks."/><meta property="twitter:description" content="Documentation for Peaks."/><meta property="og:url" content="https://halleysfifthinc.github.io/Peaks.jl/benchmarks/"/><meta property="twitter:url" content="https://halleysfifthinc.github.io/Peaks.jl/benchmarks/"/><link rel="canonical" href="https://halleysfifthinc.github.io/Peaks.jl/benchmarks/"/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">Peaks</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><a class="tocitem" href="../how-to/">How-to</a></li><li class="is-active"><a class="tocitem" href>Benchmarks</a></li><li><span class="tocitem">Reference</span><ul><li><a class="tocitem" href="../glossary/">Glossary</a></li><li><a class="tocitem" href="../reference/">API</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Benchmarks</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Benchmarks</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/halleysfifthinc/Peaks.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/halleysfifthinc/Peaks.jl/blob/master/docs/src/benchmarks.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Peak-finding-benchmarks"><a class="docs-heading-anchor" href="#Peak-finding-benchmarks">Peak finding benchmarks</a><a id="Peak-finding-benchmarks-1"></a><a class="docs-heading-anchor-permalink" href="#Peak-finding-benchmarks" title="Permalink"></a></h1><p>Peaks.jl functions can be very fast, but some features (wider window widths, support for <code>missing</code>, etc) come at a performance penalty. Below, 3 example peak finding functions<sup class="footnote-reference"><a id="citeref-1" href="#footnote-1">[1]</a></sup> and <a href="https://juliaimages.org/latest/function_reference/#Images.findlocalmaxima"><code>Images.findlocalmaxima</code></a> are benchmarked against <a href="../reference/#Peaks.argmaxima"><code>argmaxima</code></a> and <a href="../reference/#Peaks.simplemaxima"><code>simplemaxima</code></a> from Peaks.jl. (Only maxima type functions are benchmarked below, but similar results can be found for equivalent minima finding functions.)</p><p>One important difference between the Peaks.jl functions (<code>argmaxima</code>, <code>simplemaxima</code>, etc) and <code>Images.findlocalmaxima</code> or the example functions is that only Peaks.jl functions recognize plateaus. Depending on the type and origins of your data (quantized data, such as data sampled from physical measurements using ADC's, has a higher likelihood of plateaus), recognizing plateaus may or may not be an important/relevant feature. As a result, Peaks.jl functions are doing more work, but are still competitive with other obvious implementations.</p><img src="f3ddf494.svg" alt="Example block output"/><p>The data generation for the above benchmark was a sine function with a peak every 5 elements; similar results are observed for more sparsely spaced peaks. However, that benchmark may not accurately reflect real-world performance when peaks are spaced more variably<sup class="footnote-reference"><a id="citeref-2" href="#footnote-2">[2]</a></sup>.</p><p>When benchmarking against randomly sampled data, we see roughly the same performance characteristics, now presented relative to the speed of <code>simplemaxima</code> (higher is slower):</p><img src="2ad0218a.svg" alt="Example block output"/><p>The large difference in speed between <code>simplemaxima</code> and other functions is due to the use of SIMD code for suitable input arrays and element types; see the docstring for its limitations compared to <code>argmaxima</code>.</p><p><strong>Benchmarked functions</strong>:</p><details class="admonition is-details"><summary class="admonition-header">`naivemaxima`</summary><div class="admonition-body"><pre><code class="language-julia hljs">function naivemaxima(x) | ||
pks = Int[] | ||
i = firstindex(x) + 1 | ||
for i in firstindex(x)+1:lastindex(x)-1 | ||
if x[i+1] < x[i] > x[i-1] | ||
push!(pks, i) | ||
end | ||
end | ||
return pks | ||
end</code></pre></div></details><details class="admonition is-details"><summary class="admonition-header">`diffmaxima`</summary><div class="admonition-body"><pre><code class="language-julia hljs">function diffmaxima(x) | ||
dx = diff(x) | ||
return findall((diff(dx) .< 0) .& (dx[begin:end-1] .> 0) .& (dx[begin+1:end] .< 0)) .+ firstindex(x) | ||
end</code></pre></div></details><details class="admonition is-details"><summary class="admonition-header">`viewsmaxima`</summary><div class="admonition-body"><pre><code class="language-julia hljs">function viewsmaxima(x) | ||
x1 = @view x[begin:end - 2] | ||
x2 = @view x[begin+1:end - 1] | ||
x3 = @view x[begin+2:end] | ||
return axes(x,1)[2:end-1][x1 .< x2 .> x3] | ||
end</code></pre></div></details><section class="footnotes is-size-7"><ul><li class="footnote" id="footnote-1"><a class="tag is-link" href="#citeref-1">1</a>Currently/previously used by other Julia packages or public code. Those packages/codes are intentionally not named because they are not primarily peak finding packages, and the functions aren't part of their public API.</li><li class="footnote" id="footnote-2"><a class="tag is-link" href="#citeref-2">2</a>This benchmark will be distorted by how well the <a href="https://en.wikipedia.org/wiki/Branch_predictor">CPU branch-predictor</a> can learn each function; more predictable branches will make the function run faster than could be expected with more realistic data.</li></ul></section></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../how-to/">« How-to</a><a class="docs-footer-nextpage" href="../glossary/">Glossary »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Friday 23 August 2024 03:17">Friday 23 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.