[Pharo-users] Creation form from PNG file very slow on Pharo 4 and 5

Denis Kudriashov dionisiydk at gmail.com
Tue Jan 19 07:39:48 EST 2016


And more extended test:

Smalltalk garbageCollect; garbageCollect.
r1:=[FileLocator imageDirectory / 'test.fuel' readStreamDo: [ :s |
s binary.
fromFuel := (FLMaterializer newDefault materializeFrom: s) root]] benchFor:
2 seconds.

Smalltalk garbageCollect; garbageCollect.
r2 := [FileLocator imageDirectory / 'test.bmp' readStreamDo: [ :s |
s binary.
fromBMP := BMPReadWriter new on: s; nextImage]] benchFor: 2 seconds.

Smalltalk garbageCollect; garbageCollect.
r3 := [FileLocator imageDirectory / 'test.png' readStreamDo: [ :s |
s binary.
fromPNG := PNGReadWriter new on: s; nextImage]] benchFor: 2 seconds.

Smalltalk garbageCollect; garbageCollect.
r4:= [
fromAthens := (AthensCairoSurface
        createFromFile: (FileLocator imageDirectory / 'test.png') pathString
        ifFailed: []) asForm.
] benchFor: 2 seconds.


{ r1. r2. r3. r4 }.
 "an Array(a BenchmarkResult(5,537 iterations in 2 seconds 2 milliseconds.
2,766 per second) a BenchmarkResult(2,193 iterations in 2 seconds 2
milliseconds. 1,095 per second) a BenchmarkResult(443 iterations in 2
seconds 5 milliseconds. 220.948 per second) a BenchmarkResult(1,033
iterations in 2 seconds 3 milliseconds. 515.726 per second))"


2016-01-19 13:21 GMT+01:00 Esteban Lorenzano <estebanlm at gmail.com>:

> Yesterday I tested creating PNGs from disk using Athens:
>
> [(AthensCairoSurface
>         createFromFile: '/Users/esteban/Dev/Pharo/pharo50/Lenna.png'
>         ifFailed: [ ])
>         asForm] bench.
>
> That gave me 46k/s … (455k image) which IMO is pretty reasonable :)
>
> Esteban
>
> > On 19 Jan 2016, at 12:34, Sven Van Caekenberghe <sven at stfx.eu> wrote:
> >
> >
> >> On 19 Jan 2016, at 12:29, PBKResearch <peter at pbkresearch.co.uk> wrote:
> >>
> >> Denis
> >>
> >> Very interesting. It would be more interesting if you could save your
> test image as a .png file, and then include reading with PNGReadWriter in
> your comparison. This would help to confirm or refute the original point
> made by Dimitris, that reading from .png is particularly slow.
> >
> > Check the original thread/case, it is slow. Not *very* slow, but slower
> than the plugin based JPEG reader. That is what we eventually need, a
> plugin base PNG reader.
> >
> >> Peter Kenny
> >>
> >> From: Pharo-users [mailto:pharo-users-bounces at lists.pharo.org] On
> Behalf Of Denis Kudriashov
> >> Sent: 19 January 2016 10:59
> >> To: Any question about pharo is welcome <pharo-users at lists.pharo.org>
> >> Subject: Re: [Pharo-users] Creation form from PNG file very slow on
> Pharo 4 and 5
> >>
> >>
> >> 2016-01-19 11:34 GMT+01:00 Dimitris Chloupis <kilon.alios at gmail.com>:
> >>> most likely fuel, since it stores your live object as is.
> >>>
> >>> I like fuel but the fact that I may be limited by incompatible
> versions is a game stopper for me. I am ok with new version between
> incompatible with old one but there must be some backward compatibility to
> any format I use. Or else I end up worrying about things I should not be
> worrying about.
> >>
> >> You are right. I perform little experiment. Fuel reading is 60% faster
> than BMP:
> >>
> >> Smalltalk garbageCollect; garbageCollect.
> >> r1 := [FileLocator imageDirectory / 'test.bmp' readStreamDo: [ :s |
> >>            s binary.
> >> fromBMP := BMPReadWriter formFromStream: s]] benchFor: 2 seconds.
> >>
> >> Smalltalk garbageCollect; garbageCollect.
> >> r2:=[FileLocator imageDirectory / 'test.fuel' readStreamDo: [ :s |
> >>            s binary.
> >> fromFuel := (FLMaterializer newDefault materializeFrom: s) root]]
> benchFor: 2 seconds.
> >>
> >> { r1. r2 } "an Array(a BenchmarkResult(2,199 iterations in 2 seconds 2
> milliseconds. 1,098 per second) a BenchmarkResult(5,728 iterations in 2
> seconds 3 milliseconds. 2,860 per second))"
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160119/a7eafa82/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 15317 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160119/a7eafa82/attachment.png>


More information about the Pharo-users mailing list