MASSIVE performance improvement
This commit is contained in:
parent
af04945187
commit
dc27ffe14a
|
@ -58,9 +58,9 @@ def populate():
|
|||
if name.startswith(".") or ext not in (".json", ""):
|
||||
continue
|
||||
if p in DB:
|
||||
DB[name].append(grammar(load_rules(p)))
|
||||
DB[name].append(p)
|
||||
else:
|
||||
DB[name] = [grammar(load_rules(p))]
|
||||
DB[name] = [p]
|
||||
|
||||
|
||||
populate()
|
||||
|
@ -70,7 +70,7 @@ def generate(rule):
|
|||
populate()
|
||||
if rule in DB:
|
||||
g = random.choice(DB[rule])
|
||||
return g.flatten("#origin#")
|
||||
return grammar(load_rules(g)).flatten("#origin#")
|
||||
|
||||
|
||||
def listify(col):
|
||||
|
@ -94,7 +94,7 @@ def fuse(argv):
|
|||
raw = {}
|
||||
for gk in argv:
|
||||
if gk in DB:
|
||||
g = random.choice(DB[gk]).raw
|
||||
g = grammar(load_rules(random.choice(DB[gk]))).raw
|
||||
for k in g:
|
||||
if k in raw:
|
||||
raw[k] = listify(raw[k]) + listify(g[k])
|
||||
|
|
Loading…
Reference in New Issue