Skip to content

Commit

Permalink
add timing test
Browse files Browse the repository at this point in the history
  • Loading branch information
hv10 committed Nov 26, 2024
1 parent 4c9e364 commit 1829f9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
Test = "1.11.0"

[extras]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Test", "TestItemRunner", "Statistics"]
test = ["Test", "TestItemRunner", "Statistics", "BenchmarkTools"]
12 changes: 11 additions & 1 deletion test/main_tests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testsnippet MakeData begin
using Statistics
using Statistics, BenchmarkTools
make_data(len) =
map(1:len) do t
sinpi(t / 3.0) + 0im
Expand Down Expand Up @@ -117,4 +117,14 @@ end
@test a_dft a_ctfft
a_ctfft_r = PureFFT.fft_cooley_tukey(a_ctfft, plan; inverse=true, normalize=true)
@test a a_ctfft_r
end

@testitem "CT_FFT is faster than dft for bigger inputs" setup = [MakeData] begin
a = make_data(1680)
plan = PureFFT.plan_fft(1680)
display(plan)
t_dtf = @belapsed a_dft = PureFFT.dft($a)
t_ctfft = @belapsed a_ctfft = PureFFT.fft_cooley_tukey($a, $plan)
@info t_dtf, t_ctfft
@test t_dtf > t_ctfft
end

0 comments on commit 1829f9a

Please sign in to comment.