Hello,
I have a bundle with about 270 classes in it, and I couldn't help
noticing that publishing the bundle was taking one minute. I inserted
a TimeProfiler profile: in an appropriate place and republished a mock
set of changes. It turns out that many strings are being created, or
their contents are being replaced, etc. And at the leaves of the time
profiler, SystemUtils class>>validateName: appeared quite frequently.
Upon inspection, it seems like this improved implementation can do the
same thing while creating significantly less garbage. As such, it cut
about 20% of time needed to publish the package (but I only did one
run so far).
SystemUtils class >> validateName: varName
| parser allCharactersAreAcceptable |
varName isEmpty ifTrue: [^nil].
parser := Compiler preferredParserClass new.
allCharactersAreAcceptable := varName
allSatisfy: [:char | (parser isLetter: char) or: [char isDigit]].
allCharactersAreAcceptable ifFalse: [^nil].
^varName asSymbol
Hopefully somebody will find this useful. I did this in my 7.2.1
image, so maybe this has already been improved in 7.4x.
--
Best regards,
Andres mailto:
[hidden email]