[squeak-dev] FileStreams Limit
leves at caesar.elte.hu
Thu Feb 17 16:45:54 UTC 2022
On Thu, 17 Feb 2022, Jörg Belger wrote:
> Funny, I commented out some things (red) in #open:forWrite:. Now the profiler is telling me that „String new: 1“ tools 97.4%… Really? Or is this a profiler bug?
It's a limitation of the profiler. That profiler uses sampling and is
implemented entirely in Smalltalk, so it can only measure message sends.
What happens with your code is that after the #asVmPathName send a
primitive is invoked (#primOpen:writable:), and that is not a real message
Then inlined code comes (#ifNil:), which is also not a send.
Then assignments come which are also not sends.
The first actual send is String >> #new:.
So, the profiler will count everything that happend before that send
and after #asVmPathName towards String >> #new:, which is why you see such
high number there.
Since you know that String >> #new: with argument 1 is not expected to
take too long, and the same applies to #ifNil: and the assignments, you
can be sure that the time is spent in #primOpen:writable:, which is
primitiveFileOpen in FilePlugin. And that is known to be quite slow on
Windows presumably due to anti-virus measures.
More information about the Squeak-dev