Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of creating Jp2k objects #639

Open
dstansby opened this issue Apr 6, 2024 · 0 comments
Open

Improve performance of creating Jp2k objects #639

dstansby opened this issue Apr 6, 2024 · 0 comments

Comments

@dstansby
Copy link
Contributor

dstansby commented Apr 6, 2024

I often find myself wanting to create > 1000 Jp2k objects, which will then be distributed across multiple cores where the image data is actually read in. This is relatively fast on my local hard drive, but on an external drive it gets a factor of ~10 slower. Doing some quick profiling of creating 1275 Jp2k objects stored on an external SSD reveals performance could be improved by making sure that the Jp2k constructor only opens the file once; currently it opens the file twice. These are total times in seconds spent on each line of code:

├─ 4.089 Jp2k.__init__  ../../glymur/glymur/jp2k.py:189
│  ├─ 4.030 Jp2k.parse  ../../glymur/glymur/jp2k.py:647
│  │  ├─ 2.098 PosixPath.open  pathlib.py:1036
│  │  │  ├─ 2.097 open  <built-in>
│  │  │  └─ 0.001 [self]  pathlib.py
│  │  ├─ 1.874 Jp2k._validate  ../../glymur/glymur/jp2k.py:697
│  │  │  ├─ 1.866 Jp2k.codestream  ../../glymur/glymur/jp2k.py:581
│  │  │  │  ├─ 1.862 Jp2k.get_codestream  ../../glymur/glymur/jp2k.py:1824
│  │  │  │  │  ├─ 1.694 PosixPath.open  pathlib.py:1036
<rest of trace truncated>
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

No branches or pull requests

1 participant