Cap the k-space interpolation stencil at one period - #264
Open
AdamField118 wants to merge 1 commit into
Open
Conversation
Merging this PR will improve performance by 57.46%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_benchmark_moffat_init[run] |
86.8 µs | 37.5 µs | ×2.3 |
| ⚡ | WallTime | test_benchmarks_lanczos_interp[xval-no_conserve_dc-run] |
123.6 µs | 63.5 µs | +94.5% |
| ⚡ | WallTime | test_benchmarks_lanczos_interp[xval-conserve_dc-run] |
140.4 µs | 79.3 µs | +77.16% |
| ⚡ | WallTime | test_benchmarks_lanczos_interp[kval-conserve_dc-run] |
66.1 µs | 40.4 µs | +63.47% |
| ⚡ | WallTime | test_benchmark_spergel_calcfluxrad[run] |
122 µs | 78.6 µs | +55.12% |
| ⚡ | WallTime | test_benchmark_invert_ab_noraise[run] |
133.9 µs | 86.7 µs | +54.39% |
| ⚡ | WallTime | test_benchmark_spergel_init[run] |
41.3 µs | 27.3 µs | +50.99% |
| ⚡ | WallTime | test_benchmark_rng_discard[run] |
121.3 µs | 85.2 µs | +42.27% |
| ⚡ | WallTime | test_benchmarks_lanczos_interp[kval-no_conserve_dc-run] |
57.1 µs | 41.1 µs | +39.1% |
| ⚡ | WallTime | test_benchmark_gaussian_init[run] |
7.3 µs | 5.3 µs | +37.84% |
| ⚡ | WallTime | test_benchmark_spergel_init_float[run] |
7.3 µs | 5.4 µs | +36.43% |
| ⚡ | WallTime | test_benchmark_interpimage_flux_frac[run] |
439.4 µs | 332.2 µs | +32.28% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing AdamField118:sinc-kval-stencil (a04b2de) with main (e44e1a9)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #81.
Caps the k-space interpolation stencil at one period, using the closed-form
Dirichlet kernel for the sinc interpolant. The k-image is periodic and indices are
already wrapped with
% nkx, so aliases past one period land on points the stencilalready covers, sinc's
ixrangeis 63662 at the defaultkvalue_accuracy, so a9x9 draw asked for ~3e11 elements and failed to allocate. It now runs in 0.05s.
Compact interpolants (Nearest, Linear, Cubic, Quintic, Lanczos 3/5) are bitwise
identical before and after. With sinc,
kValuenow agrees with Quintic andLanczos(7) on the same image.
One deliberate difference from GalSim: the fast path triggers on
2*xrange <= nrather than
xrange() <= n, since the single-alias shortcut is only valid when thenearest other alias falls outside
xrange(the looser test is off by ~1.7e-2 forQuintic at n=4).
xvalWrappedhas no call sites in GalSim, so it isn't reachable there.Re-enabled
SincInterpolant()intest_interpolatedimage_utils.py, where it wascommented out.