summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2015-12-03 09:42:45 +0800
committerGarret Fick <garret@ficksworkshop.com>2015-12-03 09:42:45 +0800
commit221f67d8fe77ecae6c8e99db767eace5da0c1f9e (patch)
tree6289ee293aaaed85ad8dd5d0bd2d47019b584327
parentd69f50e0f62570a4c327cb8fe4f886f439196010 (diff)
downloadgerbonara-221f67d8fe77ecae6c8e99db767eace5da0c1f9e.tar.gz
gerbonara-221f67d8fe77ecae6c8e99db767eace5da0c1f9e.tar.bz2
gerbonara-221f67d8fe77ecae6c8e99db767eace5da0c1f9e.zip
Move the coordinate matching to the beginning since most of the items are coordinates. For large files, this decreases total time by 10-20%
-rw-r--r--gerber/rs274x.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 96bd136..3e262b3 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -258,6 +258,14 @@ class GerberParser(object):
did_something = True # make sure we do at least one loop
while did_something and len(line) > 0:
did_something = False
+
+ # coord
+ (coord, r) = _match_one(self.COORD_STMT, line)
+ if coord:
+ yield CoordStmt.from_dict(coord, self.settings)
+ line = r
+ did_something = True
+ continue
# Region Mode
(mode, r) = _match_one(self.REGION_MODE_STMT, line)
@@ -275,19 +283,10 @@ class GerberParser(object):
did_something = True
continue
- # coord
- (coord, r) = _match_one(self.COORD_STMT, line)
- if coord:
- yield CoordStmt.from_dict(coord, self.settings)
- line = r
- did_something = True
- continue
-
# aperture selection
(aperture, r) = _match_one(self.APERTURE_STMT, line)
if aperture:
yield ApertureStmt(**aperture)
-
did_something = True
line = r
continue