Skip to content

PERF: Speed up create_input when dates are already np.datetime64#87

Merged
greglucas merged 1 commit intoSWxTREC:mainfrom
scottshambaugh:perf_improvements
Jul 9, 2025
Merged

PERF: Speed up create_input when dates are already np.datetime64#87
greglucas merged 1 commit intoSWxTREC:mainfrom
scottshambaugh:perf_improvements

Conversation

@scottshambaugh
Copy link
Contributor

In my workflow, about 65% of the pymsis runtime is spent in manipulating the python inputs rather than running the core code. This small change avoids some array creations and speeds up overall runtime by about 25% for me!

Before:
image

After:
image

@scottshambaugh
Copy link
Contributor Author

Not sure why ruff is complaining

@greglucas
Copy link
Member

Not sure why ruff is complaining

It wants it all on one line I think now that it is shortened. Can you run ruff format on the file and commit that?

@scottshambaugh
Copy link
Contributor Author

Good to go!

@greglucas
Copy link
Member

:( now mypy doesn't like the updates. Sorry about all this hassle... I had a hard time satisfying the type checker going through that portion previously too, maybe we should just disable it for some of those variables/sections?

Simplify line of code

formatting

ruff
@scottshambaugh
Copy link
Contributor Author

Ok hopefully that does it...

@scottshambaugh scottshambaugh changed the title Speed up create_input when dates are already np.datetime64 PERF: Speed up create_input when dates are already np.datetime64 Jul 9, 2025
@greglucas
Copy link
Member

Thanks @scottshambaugh!

Also I was checking some other timings and found some compiler optimization improvements you might be interested in here: #84

@greglucas greglucas merged commit 320dd99 into SWxTREC:main Jul 9, 2025
28 checks passed
@scottshambaugh
Copy link
Contributor Author

scottshambaugh commented Jul 9, 2025

Oh cool! I'm not on windows so can't play around with those build options. Will keep my eye open for the next release that incorporates all this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants