[squeak-dev] Question about inlining | How to access named temps in FullBlockClosure?

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Mar 30 18:10:20 UTC 2020


> | 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 ] ].

This still timed out my patience after 10 minutes :(
<http://www.hpi.de/>
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von tim Rowledge <tim at rowledge.org>
Gesendet: Montag, 30. März 2020 19:42:31
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] Question about inlining | How to access named temps in FullBlockClosure?



> On 2020-03-30, at 10:36 AM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>
>
> 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.

And a smidge over 10 sec on my Pi 4 :-)

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
A computer program does what you tell it to do, not what you want it to do.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200330/1183a99c/attachment.html>


More information about the Squeak-dev mailing list