wmwv / cosmo

Go cosmology library
MIT License
7 stars 2 forks source link

Compare performance to AstroPy cosmology #3

Open wmwv opened 6 years ago

wmwv commented 6 years ago
  1. [x] Compare performance to AstroPy cosmology
  2. [ ] Explore alternate ways of doing vectorization in both AstroPy and Go
wmwv commented 6 years ago

astropy.cosmology.FlatLambdCDM(...).comoving_distance calculates 10^6 distances from an array of redshifts in 13 s.

wmwv commented 6 years ago

Using an elliptic integral approach in Python is ~10 faster. Takes 1 s for 10^6 distances.

wmwv commented 6 years ago

After adopting Elliptic integration functions, the Go routines are 700 ns/distance calculated. The base astropy.cosmology.FlatLambdaCDM(...).comoving_distance is 13,100 ns/distance calculated. The routine I wrote in Python using scipy.special.ellipkinc is 300 ns/distance calculated.

So (a) there's a factor of 2 improvement likely possible in my current go implementation; and (b) I should submit a PR to AstroPy for speeding up the astropy.cosmology.FlatLambdaCDM(...).comoving_distance calculation.