lincc-frameworks / tdastro

MIT License
4 stars 0 forks source link

Speed up unit conversions #179

Closed jeremykubica closed 2 weeks ago

jeremykubica commented 2 weeks ago

Do a single matrix multiply instead of carrying the units through the full computation.

github-actions[bot] commented 2 weeks ago
Before [88bd2263] After [600586a4] Ratio Benchmark (Parameter)
11.0±1ms 9.57±0.5ms ~0.87 benchmarks.TimeSuite.time_evaluate_salt3_model
2.23±1ms 842±600μs ~0.38 benchmarks.TimeSuite.time_fnu_to_flam
121±2μs 125±2μs 1.04 benchmarks.TimeSuite.time_sample_x0_from_distmod
1.49±0.08ms 1.49±0.1ms 1.00 benchmarks.TimeSuite.time_apply_passbands
9.13±0.06ms 9.10±0.2ms 1.00 benchmarks.TimeSuite.time_load_passbands
15.7±0.5μs 15.7±0.2μs 1.00 benchmarks.TimeSuite.time_sample_x1_from_hostmass
4.66±1ms 4.61±0.3ms 0.99 benchmarks.TimeSuite.time_chained_evaluate
1.37±0.02s 1.36±0.01s 0.99 benchmarks.TimeSuite.time_make_x1_from_hostmass
28.8±0.5μs 28.2±0.3μs 0.98 benchmarks.TimeSuite.time_make_new_salt3_model
5.85±0.3ms 5.08±0.2ms 0.87 benchmarks.TimeSuite.time_evaluate_salt3_passbands

Click here to view all benchmarks.

jeremykubica commented 2 weeks ago

Running this function in test_snia.py takes about 50% of the time (with the asarray change as well).