Last active
December 24, 2015 06:09
-
-
Save bwhitman/6754957 to your computer and use it in GitHub Desktop.
FFT performance on the 5s 64-bit mode vs. 32-bit mode
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
/* | |
100,000 iterations of a 1024 point real->imag FFT, computing magnitude & phase and then its inverse again | |
Run twice, once with double precision and then again using the single precision float vDSP | |
5s in 32 bit mode | |
2013-09-29 13:48:47.009 perf[3513:60b] doFFT double precision took 157.924796 seconds | |
2013-09-29 13:49:13.707 perf[3513:60b] doFFT single precision took 26.697247 seconds | |
5s in 64 bit mode | |
2013-09-29 13:51:47.402 perf[3524:60b] doFFT double took 57.861582 seconds (2.7x speedup over 32-bit mode) | |
2013-09-29 13:52:06.063 perf[3524:60b] doFFT single took 18.660364 seconds (1.4x speedup over 32-bit mode) | |
The code being iterated (N=1024): | |
*/ | |
void dofftD() { | |
vDSP_ctozD((DSPDoubleComplex*)xD, 2, &tempSplitComplexD, 1, N/2); | |
vDSP_fft_zripD(fftSetupD, &tempSplitComplexD, 1, LOG_N, kFFTDirection_Forward); | |
vDSP_zvabsD(&tempSplitComplexD, 1, magD, 1, N/2); | |
vDSP_zvphasD(&tempSplitComplexD, 1, phaseD, 1, N/2); | |
tempSplitComplexD.realp = magD; | |
tempSplitComplexD.imagp = phaseD; | |
vDSP_ztocD(&tempSplitComplexD, 1, tempComplexD, 2, N/2); | |
vDSP_rectD((double*)tempComplexD, 2, (double*)tempComplexD, 2, N/2); | |
vDSP_ctozD(tempComplexD, 2, &tempSplitComplexD, 1, N/2); | |
vDSP_fft_zripD(fftSetupD, &tempSplitComplexD, 1, LOG_N, kFFTDirection_Inverse); | |
vDSP_ztocD(&tempSplitComplexD, 1, (DSPDoubleComplex*)yD, 2, N/2); | |
double scale = 0.5/N; | |
vDSP_vsmulD(yD, 1, &scale, yD, 1, N); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment