[Cuis-dev] StandardFileStream #next: slow?

Philip Bernhart philip.bernhart at posteo.de
Thu May 7 16:03:41 PDT 2020


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


More information about the Cuis-dev mailing list