[Cuis-dev] StandardFileStream #next: slow?

Juan Vuletich juan at jvuletich.org
Fri May 8 07:07:37 PDT 2020


Hi Philip,

On 5/7/2020 8:03 PM, Philip Bernhart via Cuis-dev wrote:
> Hi,
>
> I noticed while refactoring the Cryptography-DigitalSignatures
> package and testing with bigger files, that the StandardFileStream
> seems to be slow in some circumstances (it takes 1 minute when file size
> ~ 60 MB). Atleast that is what #timeProfile shows me.
>
>    alg := SecureHashAlgorithm256 new.
>    [
>       '/home/user/foobar.mp3' readStreamDo: [:stream|
>       stream binary. alg hashStream: stream ]
>    ] timeProfile
>
>
> Sure, the algorithm is not ideally implemented. But after
> changing things around I still noticed that #timeProfile
> shows 98% in #next: and not in some other places of the code.
>
> When running just
>    [
>       '/home/user/foobar.mp3' readStreamDo: [:stream|
>       stream binary. stream next: 64 ]
>    ] timeProfile
>
> it returns in 500ms and still shows that #next: takes about
> 98% of the time.
>
> It's confusing that the actual algorithm specifics doesn't
> seem to change much of the ratios.
>
> Have you some ideas about this or general advise on
> optimizing reading things and processing them in Cuis?
>
>
> Thanks,
> Philip

Given that you can read the 60MB file in half a second, it doesn't 
really look like #next: is that slow. Maybe it is a reporting issue. 
Does any line in the profile include this text: '-- primitive (real 
sender possibly omitted, see #profilerFriendlyCall:)'? If so, please 
take a look at #profilerFriendlyCall:.

Otherwise, prepare a test we can repeat, including the file you used (it 
can be any file, for example our own CuisV5.sources, or any other large 
file you can provide an url for). Also include some details on the 
platform, processor, vm, etc.

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich



More information about the Cuis-dev mailing list