Skip to content

Comments

fft#343

Closed
lpatiny wants to merge 5 commits intomainfrom
fft
Closed

fft#343
lpatiny wants to merge 5 commits intomainfrom
fft

Conversation

@lpatiny
Copy link
Member

@lpatiny lpatiny commented Feb 18, 2026

  • test: add simple benchmark
  • chore: ignore CPU. files
  • feat: allow inplace reimFFT

import type { DataReIm } from '../types/index.ts';
import { xRotate } from '../x/index.ts';

let output: Float64Array | undefined;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@targos those arrays are recreated each time we call this method which consume some memory especially on 2D for which we call this method maybe 256 times with the same size.

Is it acceptable to define them globally the code being sync ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a fan. This will keep the last used objects indefinitely in memory.

I would rather export a function that creates an object with these arrays, and accept that object as an option.

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.89%. Comparing base (b829991) to head (a968f1a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #343   +/-   ##
=======================================
  Coverage   96.88%   96.89%           
=======================================
  Files         190      190           
  Lines        3601     3607    +6     
  Branches      910      915    +5     
=======================================
+ Hits         3489     3495    +6     
  Misses        108      108           
  Partials        4        4           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


let output: Float64Array | undefined;
let complexArray: Float64Array | undefined;
let fft: FFT | undefined;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also cache the FFT instance and I think it is ok. With this I can win a factor 2 in my benchmark reimFFT (3000 to 6800 iterations in 5s)

@lpatiny
Copy link
Member Author

lpatiny commented Feb 19, 2026

Keeping a pointer to a large object is not a good idea. In order to optimize we will create a new method reimArrayFFT

#344

@lpatiny lpatiny closed this Feb 19, 2026
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