isce-framework / isce-framework/s1-reader
Loading all bursts in a granule can be sped up with `@cache` on XML parsing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
With a few small adjustments and adding @functools.cache on the ET.parse call for the precise orbit, we can speed up loading the bursts by a bunch.
See (parsing the precise orbit file, which happens once per subswath)
https://github.com/opera-adt/burst_db/blob/main/src/burst_db/historical_bursts/parse_bursts.py#L363-L364
and here (for the iteration of the element list to get just the UTC times and Zs)
https://github.com/opera-adt/burst_db/blob/main/src/burst_db/historical_bursts/parse_bursts.py#L449-L459
I think these were the two main changes. It makes getting all 30 bursts from a file go from 420 ms to 65 ms:
In [1]: import s1reader
In [2]: import burst_db.historical_bursts.parse_bursts
In [3]: file = 'S1A_IW_SLC__1SDV_20200102T111719_20200102T111747_030620_038227_9FE9.SAFE'
In [4]: o = 'S1A_OPER_AUX_POEORB_OPOD_20210316T184157_V20200101T225942_20200103T005942.EOF'
In [10]: %time [s1reader.load_bursts(file, o, idx) for idx in [1,2,3]]
CPU times: user 387 ms, sys: 32.5 ms, total: 419 ms
Wall time: 424 ms
In [8]: %time bursts = burst_db.historical_bursts.parse_bursts.bursts_from_safe_dir(file, o)
CPU times: user 18.3 ms, sys: 3.61 ms, total: 22 ms
Wall time: 65.3 ms
Seems worth making the small refactor at some point
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/burst_db/historical_bursts/parse_bursts.py at the precise-orbit parsing lines 363-364 and element-list iteration at lines 449-459. Reproduce the supplied burst-loading timing comparison, then verify that loading all bursts from the SAFE directory achieves the intended performance improvement without changing results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100