MWATelescope / Birli

A Rust library for preprocessing tasks in the Murchison Widefield Array (MWA) data pipeline.
Mozilla Public License 2.0
16 stars 3 forks source link

Optimisations in correction code #83

Closed cjordan closed 2 years ago

cjordan commented 2 years ago

There's some "low-hanging fruit" in the correction code. It's hard to know if changing these will make a difference, because the compiler might be smart enough already, but we should fix these anyway, and do a benchmark.

https://github.com/MWATelescope/Birli/blob/64c35b5644c0bc73245eb56012c757ee7314bc81/src/corrections.rs#L130 https://github.com/MWATelescope/Birli/blob/64c35b5644c0bc73245eb56012c757ee7314bc81/src/corrections.rs#L139 https://github.com/MWATelescope/Birli/blob/64c35b5644c0bc73245eb56012c757ee7314bc81/src/corrections.rs#L296

Note that .clone() on the Range structs remains necessary, but those are very cheap. Otherwise .clone() should be avoided as much as possible.

d3v-null commented 2 years ago

mmm, good spot, there are a certainly a lot of these quick hacks I did to satisfy the linter when I first started writing Rust. I'd like to find some time to fix these outstanding issues in a new point release, but I don't know when I'm going to be "finished" with this DI spike enough to be able to context switch back to Birli again.

Note for future self: another big optimization would be to pre-calculate all the uvws in the corrections.