EDF.jl icon indicating copy to clipboard operation
EDF.jl copied to clipboard

Reads take approximately 10x longer than BDF.jl

Open klaff opened this issue 2 years ago • 5 comments

Using bdf_test.bdf file (https://github.com/beacon-biosignals/EDF.jl/blob/master/test/data/bdf_test.bdf) and the following MWE:

using BDF
using EDF
using BenchmarkTools

# BDF and EDF have very different APIs

get_ch1_using_BDF(fn) = readBDF(fn)[1][1,:]

get_ch1_using_EDF(fn) = EDF.decode(EDF.read(fn).signals[1])

test_filename = "bdf_test.bdf"

println("using BDF:")
@btime get_ch1_using_BDF(test_filename)
println("\nusing EDF:")
@btime get_ch1_using_EDF(test_filename)

I obtain the following:

using BDF:
  755.700 μs (305 allocations: 2.61 MiB)

using EDF:
  17.460 ms (146253 allocations: 2.87 MiB)

Hint: EDF is allocating once for every 3 bytes of data (this file has 24-bit data)

klaff avatar Oct 08 '21 21:10 klaff