Repository navigation
Reduce Python FFT and C# channel-packing overhead - #871
Open
Andrey1994 wants to merge 3 commits into
Open
Andrey1994 wants to merge 3 commits into
Andrey1994 wants to merge 3 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| var data = new double[4, 1024]; | ||
| for (int row = 0; row < 4; row++) | ||
| for (int col = 0; col < 1024; col++) | ||
| data[row, col] = Math.Sin(2 * Math.PI * (5 + row * 7) * col / 256.0); |
| throw new Exception("Selected/repeated channel powers changed"); | ||
| for (int row = 0; row < 4; row++) | ||
| for (int col = 0; col < 1024; col++) | ||
| if (data[row, col] != original[row, col]) |
| var actual = DataFilter.get_custom_band_powers(data, bands, channels, 256, false); | ||
| var expected = DataFilter.get_custom_band_powers(selected, bands, new[] {0, 1, 2}, 256, false); | ||
| for (int band = 0; band < bands.Length; band++) | ||
| if (actual.Item1[band] != expected.Item1[band] || actual.Item2[band] != expected.Item2[band]) |
| var actual = DataFilter.get_custom_band_powers(data, bands, channels, 256, false); | ||
| var expected = DataFilter.get_custom_band_powers(selected, bands, new[] {0, 1, 2}, 256, false); | ||
| for (int band = 0; band < bands.Length; band++) | ||
| if (actual.Item1[band] != expected.Item1[band] || actual.Item2[band] != expected.Item2[band]) |
This was referenced Nov 3, 2026
This branch has not been deployed
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.
Python FFT/IFFT wrappers convert complex values in scalar Python loops, and C# band-power/ICA wrappers repeatedly allocate copied rows while packing selected channels. Use NumPy array assignments and contiguous real/imaginary buffers, and pack C# rows directly into one buffer while validating channel bounds.
Local Windows probes measured 11.2x faster Python FFT calls at 2,048 samples and 3.5–4.5x faster C# packing at 64 x 2,000 samples. These are operation-specific measurements, not application-wide speedups. C# packing allocations dropped from 4.13 MB to 1.02 MB per call.
Validation: freshly built MSVC Release /MT DataHandler; 19 signal-processing and 18 band-power Python tests passed; C# Release build and signal-processing regression passed. Added coverage for strided complex input, repeated/reordered channels, input preservation, and invalid channel indices. Tests run in the existing regression CI jobs.
Also repair the shared CI failures: stage native dylibs beside the macOS C# regression executable, report C++ test exceptions through a nonzero exit status, and guard allocation failure/overflow in the macOS Bluetooth pipe resize.
Part of #601. Independent of the file-reader, DSP-context, and acquisition changes.