mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Improve savings in ShrinkNames.
The reusable names table was being emptied as identifiers were used. This was sub-optimal for function parameters, because new identifiers would need to be created when exhausted. Reset the reusable names list to a saved copy every time a new parameter list is started, in a similar fashion to what we did with the sequentially generated identifiers.
This commit is contained in:
parent
8358fd5012
commit
3686d490a2
1 changed files with 3 additions and 2 deletions
|
@ -156,6 +156,8 @@ class renamer(object):
|
||||||
# long distinct names.
|
# long distinct names.
|
||||||
First = True
|
First = True
|
||||||
restart = self.WordFirstChar
|
restart = self.WordFirstChar
|
||||||
|
restartReusable = ReusableNames
|
||||||
|
ReusableNames = restartReusable.copy()
|
||||||
for table in self.symtab:
|
for table in self.symtab:
|
||||||
if First:
|
if First:
|
||||||
First = False
|
First = False
|
||||||
|
@ -174,9 +176,8 @@ class renamer(object):
|
||||||
# Parameter tables are isolated from each other.
|
# Parameter tables are isolated from each other.
|
||||||
InParams = True
|
InParams = True
|
||||||
self.WordFirstChar = restart
|
self.WordFirstChar = restart
|
||||||
|
ReusableNames = restartReusable.copy()
|
||||||
# Same procedure as for global vars
|
# Same procedure as for global vars
|
||||||
# Not the best strategy (using locally unique names would
|
|
||||||
# do a better job) but hey.
|
|
||||||
if ReusableNames:
|
if ReusableNames:
|
||||||
short = ReusableNames.pop()
|
short = ReusableNames.pop()
|
||||||
self.UsedNames.add(short)
|
self.UsedNames.add(short)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue