astrogo / fitsio

fitsio is a pure-Go package to read and write `FITS` files
BSD 3-Clause "New" or "Revised" License
53 stars 24 forks source link

fitsio: improve perfs of Image.Read #26

Closed sbinet closed 7 years ago

sbinet commented 7 years ago

This CL provides a fast-path for when the on-disk data and the provided data are of the same type, for Image.Read.

name                   old time/op    new time/op    delta
ImageReadF64_10-4        4.95µs ± 6%    0.91µs ± 1%  -81.69%  (p=0.000 n=10+7)
ImageReadF64_100-4       44.2µs ± 4%     6.0µs ± 8%  -86.41%  (p=0.000 n=8+10)
ImageReadF64_1000-4       431µs ± 7%      58µs ± 5%  -86.58%  (p=0.000 n=10+10)
ImageReadF64_10000-4     4.38ms ± 4%    0.58ms ± 7%  -86.86%  (p=0.000 n=10+10)
ImageReadF64_100000-4    46.5ms ± 5%     6.1ms ± 3%  -86.84%  (p=0.000 n=10+10)

name                   old alloc/op   new alloc/op   delta
ImageReadF64_10-4          480B ± 0%      160B ± 0%  -66.67%  (p=0.000 n=10+10)
ImageReadF64_100-4       3.36kB ± 0%    0.88kB ± 0%  -73.81%  (p=0.000 n=10+10)
ImageReadF64_1000-4      32.2kB ± 0%     8.1kB ± 0%  -74.88%  (p=0.000 n=10+10)
ImageReadF64_10000-4      320kB ± 0%      80kB ± 0%  -74.99%  (p=0.000 n=10+10)
ImageReadF64_100000-4    3.20MB ± 0%    0.80MB ± 0%  -75.00%  (p=0.000 n=7+10)

name                   old allocs/op  new allocs/op  delta
ImageReadF64_10-4          43.0 ± 0%      12.0 ± 0%  -72.09%  (p=0.000 n=10+10)
ImageReadF64_100-4          403 ± 0%       102 ± 0%  -74.69%  (p=0.000 n=10+10)
ImageReadF64_1000-4       4.00k ± 0%     1.00k ± 0%  -74.97%  (p=0.000 n=10+10)
ImageReadF64_10000-4      40.0k ± 0%     10.0k ± 0%  -75.00%  (p=0.000 n=10+10)
ImageReadF64_100000-4      400k ± 0%      100k ± 0%  -75.00%  (p=0.000 n=10+10)