Performance boost: reduce instantiations of re.Scanner
- Lexer is the same for every Spec parser in spack, so don't build it every time. - This improves time to import package.py files a lot, as a Lexer doesn't have to be constructed for every spc in the packages. - To concretize dealii: - Before: ~20 sec - After: ~6 sec
This commit is contained in:
parent
6dcdb50a3e
commit
e8b4d5fb6f
@ -2015,10 +2015,13 @@ def __init__(self):
|
||||
(r'\s+', lambda scanner, val: None)])
|
||||
|
||||
|
||||
# Lexer is always the same for every parser.
|
||||
_lexer = SpecLexer()
|
||||
|
||||
class SpecParser(spack.parse.Parser):
|
||||
|
||||
def __init__(self):
|
||||
super(SpecParser, self).__init__(SpecLexer())
|
||||
super(SpecParser, self).__init__(_lexer)
|
||||
self.previous = None
|
||||
|
||||
def do_parse(self):
|
||||
|
Loading…
Reference in New Issue
Block a user