[squeak-dev] Question about inlining | How to access named temps in FullBlockClosure?
Levente Uzonyi
leves at caesar.elte.hu
Mon Mar 30 17:36:35 UTC 2020
Hi Christoph,
On Fri, 27 Mar 2020, Christoph Thiede wrote:
> Hi Eliot,
>
>> Quite right. Can you find out how common cases like these are? I bet you
>> there will be five methods or less in trunk that are affected.
>
> I did a full search in my image:
>
> pattern := '.*to\:[\s\r\n]*\w+[\s\r\n]*do\:[\s\r\n]*\[[^\]]*\[.*' asRegex.
> self systemNavigation allMethods select: [:m |
> pattern matches: m getSource].
>
> My Source Files are very slow,
> <http://forum.world.st/The-Inbox-ShoutCore-ct-78-mcz-tp5109909p5110050.html>
> so I interrupted the script after one hour, but I still found more than 250
> matches. I took some samples and they looked indeed relevant. Nested #to:do:
> loops, for example ...
Try this instead:
| regex |
regex := 'to\:[\s\r\n]*\w+[\s\r\n]*do\:[\s\r\n]*\[[^\]]*\[' asRegex.
CurrentReadOnlySourceFiles cacheDuring: [
SystemNavigation default browseAllSelect: [ :method |
regex search: method getSource asString ] ].
The key differences are:
- caching source files (as Nicolas suggested)
- converting the source to String from Text (regex is intended to work
with Strings not Texts)
- using #search: instead of #matches:
This brings down the runtime to 2.5 seconds on my machine.
Levente
> Or do I misunderstand your idea of a rule?
>
> However, if we can agree on leaving it as it is, it's irrelevant ;-)
>
> Best,
> Christoph
>
>
>
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html
More information about the Squeak-dev
mailing list
|