Make ds9 region file parser fast
- Dominant language
- Python
- Stars
- 41
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
The docs contain this note: "pyregion is rather slow, likely due to a inefficient parser."
( see http://pyregion.readthedocs.org/en/latest/index.html#documentation )
It's really slow ... parsing 1000 simple circle regions
``` python
with open('ds9.reg', 'w') as f:
for _ in range(1000):
f.write('circle(0,0,1)\n')
```
takes 7 seconds:
```
%time pyregion.open('ds9.reg')
CPU times: user 7.59 s, sys: 20 ms, total: 7.61 s
```
Astropy bundles [ply](http://www.dabeaz.com/ply/), so if someone takes this on it might be worth considering using `ply` (currently [pyparsing](http://pyregion.readthedocs.org/en/latest/users/installing.html#pyparsing) is used).
I'm using `pyregion` in a data analysis / image plotting pipeline and region file parsing is actually the bottleneck, but it's acceptable and I'm not very familiar with parsing and region files, so I don't plan to take this on ... just wanted to make a GH issue so this known issue is not forgotten.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at pyregion.open and the current pyparsing-based parser, then reproduce the 1,000-circle benchmark described in the issue. Done means materially faster parsing of that example while preserving existing behavior; no implementation path or test file is named, so parser design and regression coverage need to be established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100