<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 17, 2016 at 1:17 PM, David T. Lewis <span dir="ltr"><<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Bernhard,<br>
<br>
InterpreterPlugin is part of the VMMaker package, so you would need to be<br>
working in an image with VMMaker loaded (maybe one of the prepared image<br>
from Eliot's site).<br></blockquote><div><br></div><div>There aren't any. There is a script in the image subdirectory of <a href="http://www.github.com/opensmalltalk/vm">http://www.github.com/opensmalltalk/vm</a> which builds one; see image/buildspurtrunkvmmakerimage.sh</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I should have checked my own notes before replying - I cannot explain the<br>
reason for this, but it seems that the readdir() primitives no longer<br>
provided any performance benefit when I tested them a couple of years ago.<br>
<br>
Here is what I wrote in the summary on<br>
<a href="http://www.squeaksource.com/DirectoryPlugin" rel="noreferrer" target="_blank">http://www.squeaksource.com/<wbr>DirectoryPlugin</a>:<br>
<br>
Performance characteristics have changed significantly since Squeak circa<br>
2003. The readdir() primitives no longer provide any benefit, but the file<br>
testing primitives still yield a couple orders of magnitude improvement<br>
for some functions.<br>
<br>
<br>
So ... I guess that some additional profiling would be in order.<br>
<br>
Dave<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
> Hi Dave,<br>
><br>
> Thanks for the answer. I guess I would need to build the latest version of<br>
> the plugin myself, right? (I am on macOS Sierra.)<br>
><br>
> I could load DirectoryPlugin. However,<br>
> VMConstruction-Plugins-<wbr>DirectoryPlugin needs InterpreterPlugin available.<br>
><br>
> Bernhard<br>
><br>
>> Am 17.10.2016 um 19:56 schrieb David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>>:<br>
>><br>
>> It is probably far too bit-rotted to be of any use now, but here is what<br>
>> I<br>
>> came up with 15 years ago to improve this:<br>
>><br>
>> <a href="http://wiki.squeak.org/squeak/2274" rel="noreferrer" target="_blank">http://wiki.squeak.org/squeak/<wbr>2274</a><br>
>><br>
>> I did briefly look at this again a couple of years ago, and put the<br>
>> updates on SqueakSource. But I think I found that the directory<br>
>> primitives<br>
>> are nowhere near as big a win now as they were 15 years ago.<br>
>> Nevertheless<br>
>> it may still be of some interest.<br>
>><br>
>> Dave<br>
>><br>
>>> Dear Squeakers,<br>
>>><br>
>>> I want to count files with a certain extension in a folder recursively.<br>
>>> Here is the code I use:<br>
>>><br>
>>> | dir count runtime |<br>
>>> count := 0.<br>
>>> dir := FileDirectory on:<br>
>>> '/Users/bernhard/Library/Mail/<wbr>V4/D77E3582-7EBE-4B5A-BFE0-<wbr>E30BF6AE995F/Smalltalk.mbox/<wbr>Squeak.mbox'.<br>
>>> runtime := Time millisecondsToRun: [<br>
>>> dir directoryTreeDo: [:each |<br>
>>> (each last name endsWith: '.emlx') ifTrue: [count := count + 1]]].<br>
>>> {count. runtime}. #(289747 66109)<br>
>>><br>
>>> As you can see it finds 289.747 files and it takes about 66 seconds. Is<br>
>>> there any faster way to do this given the current VM primitives?<br>
>>><br>
>>> The reason I ask is that the equivalent Python code takes between 1.5<br>
>>> and<br>
>>> 6 seconds. :-/<br>
>>><br>
>>> #!/usr/local/bin/python3<br>
>>> import os<br>
>>> import time<br>
>>><br>
>>> path =<br>
>>> '/Users/bernhard/Library/Mail/<wbr>V4/D77E3582-7EBE-4B5A-BFE0-<wbr>E30BF6AE995F/Smalltalk.mbox/<wbr>Squeak.mbox'<br>
>>><br>
>>> print(path)<br>
>>><br>
>>> start = time.time()<br>
>>> emlx = 0<br>
>>> for dirpath, dirnames, filenames in os.walk(path):<br>
>>> for filename in filenames:<br>
>>> if filename.endswith('.emlx'):<br>
>>> emlx += 1<br>
>>><br>
>>> runtime = time.time() - start<br>
>>><br>
>>> print(emlx, runtime)<br>
>>><br>
>>> It seems to have to do with an optimized os.scandir() function,<br>
>>> described<br>
>>> here: <a href="https://www.python.org/dev/peps/pep-0471/" rel="noreferrer" target="_blank">https://www.python.org/dev/<wbr>peps/pep-0471/</a><br>
>>><br>
>>> Cheers,<br>
>>> Bernhard<br>
>>><br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
><br>
><br>
<br>
<br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>