Skip to content

Conversation

@cjfuller
Copy link
Collaborator

This commit adds a couple utilities to make the dev experience for profiling nicer: a context manager that logs the time it takes the context to run, and a context manager that writes stats to disk with cProfile for the contained context.

I found a small speedup using these (and a bigger one to come in another commit): use numpy for the stitching itself when the data fits in memory (so far it always seems to be faster to write using dask, even taking into account the time it takes to make a dask array from the numpy one).

This shaves off 1-2s from the total run time for the usual 8x8 fov example test case.

Tested by:

  • ./dev/autofix_lint.sh
  • ./dev/format.sh
  • ./dev/type_check.sh
  • ./dev/run_tests.sh

This commit adds a couple utilities to make the dev experience for
profiling nicer: a context manager that logs the time it takes the
context to run, and a context manager that writes stats to disk with
cProfile for the contained context.

I found a small speedup using these (and a bigger one to come in another
commit): use numpy for the stitching itself when the data fits in memory
(so far it always seems to be faster to write using dask, even taking
into account the time it takes to make a dask array from the numpy one).

This shaves off 1-2s from the total run time for the usual 8x8 fov
example test case.

Tested by:
- `./dev/autofix_lint.sh`
- `./dev/format.sh`
- `./dev/type_check.sh`
- `./dev/run_tests.sh`
@cjfuller
Copy link
Collaborator Author

@ianohara adding you as a reviewer mainly as an FYI here, but happy to respond to any feedback you have!

@cjfuller cjfuller merged commit d729fef into main Jan 16, 2025
@cjfuller cjfuller deleted the colin/profile_tools_and_minor_opt branch January 16, 2025 22:02
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