Speed up JPG images loading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Speed up JPG images loading

Pharo Smalltalk Users mailing list
Dears,
        I'm loading a lot of pictures (70) through the method
"ImageReadWriter>>formFromFileNamed:".
The method is very slow, with images bigger than 5MB.

        Is there a way to improve the pictures speed loading?


Thanks
Matteo

Reply | Threaded
Open this post in threaded view
|

Re: Speed up JPG images loading

Sven Van Caekenberghe-2
Hi Matteo,

> On 5 Nov 2016, at 16:11, Matteo via Pharo-users <[hidden email]> wrote:
>
>
> From: Matteo <[hidden email]>
> Subject: Speed up JPG images loading
> Date: 5 November 2016 at 16:10:45 GMT+1
> To: "Pharo is welcome (ML)" <[hidden email]>
>
>
> Dears,
> I'm loading a lot of pictures (70) through the method
> "ImageReadWriter>>formFromFileNamed:".
> The method is very slow, with images bigger than 5MB.
>
> Is there a way to improve the pictures speed loading?
>
>
> Thanks
> Matteo

I think we'll need more details.

Here is what I tried:

(ImageReadWriter formFromFileNamed: '/Users/sven/Desktop/audio359-main-1600.jpg') asMorph openInWindow.

This is a 319K JPG 1600x2263 (Form's Bitmap length is 3620800).

[ ImageReadWriter formFromFileNamed: '/Users/sven/Desktop/audio359-main-1600.jpg' ] bench.
 
'2.788 per second'

2 to 3 per second is not very fast, but you create forms of 3.5M - In this case the PluginBasedJPEGReadWriter is used, which should be faster then any of the other formats.

What you can do is store a FUEL version of the Form on file, that will be (much) faster (but much larger, it is basically a non-compressed version).

Sven


Reply | Threaded
Open this post in threaded view
|

Re: Speed up JPG images loading

Sven Van Caekenberghe-2
I found a reference to a similar discussion from the past:

  https://pharo.fogbugz.com/f/cases/17403/Creating-Forms-from-PNGs-is-very-slow

Matteo,

This is part of what I wrote (for a smaller PNG):

'http://pharo.org/files/pharo.png' asZnUrl saveContentsToFile: 'pharo.png'.

'pharo.png' asFileReference size. "34696"

[ Form fromFileNamed: 'pharo.png' ] benchFor: 10 seconds.

"a BenchmarkResult(615 iterations in 10 seconds 14 milliseconds. 61.414 per second)"

"0.016282926s per execution"

FLSerializer serialize: (Form fromFileNamed: 'pharo.png') toFileNamed: 'pharo.form.fuel'.

[ FLMaterializer materializeFromFileNamed: 'pharo.form.fuel' ] benchFor: 10 seconds.

"a BenchmarkResult(16,443 iterations in 10 seconds 2 milliseconds. 1,644 per second)"

"0:00:00:00.000608283s per execution"

Sven

> On 5 Nov 2016, at 19:23, Sven Van Caekenberghe <[hidden email]> wrote:
>
> Hi Matteo,
>
>> On 5 Nov 2016, at 16:11, Matteo via Pharo-users <[hidden email]> wrote:
>>
>>
>> From: Matteo <[hidden email]>
>> Subject: Speed up JPG images loading
>> Date: 5 November 2016 at 16:10:45 GMT+1
>> To: "Pharo is welcome (ML)" <[hidden email]>
>>
>>
>> Dears,
>> I'm loading a lot of pictures (70) through the method
>> "ImageReadWriter>>formFromFileNamed:".
>> The method is very slow, with images bigger than 5MB.
>>
>> Is there a way to improve the pictures speed loading?
>>
>>
>> Thanks
>> Matteo
>
> I think we'll need more details.
>
> Here is what I tried:
>
> (ImageReadWriter formFromFileNamed: '/Users/sven/Desktop/audio359-main-1600.jpg') asMorph openInWindow.
>
> This is a 319K JPG 1600x2263 (Form's Bitmap length is 3620800).
>
> [ ImageReadWriter formFromFileNamed: '/Users/sven/Desktop/audio359-main-1600.jpg' ] bench.
>
> '2.788 per second'
>
> 2 to 3 per second is not very fast, but you create forms of 3.5M - In this case the PluginBasedJPEGReadWriter is used, which should be faster then any of the other formats.
>
> What you can do is store a FUEL version of the Form on file, that will be (much) faster (but much larger, it is basically a non-compressed version).
>
> Sven
>


Reply | Threaded
Open this post in threaded view
|

Re: Speed up JPG images loading

Ben Coman
In reply to this post by Pharo Smalltalk Users mailing list
What does the Time Profiler show?
Can you link to a sample picture?

cheers -ben

On Sat, Nov 5, 2016 at 11:11 PM, Matteo via Pharo-users
<[hidden email]> wrote:

>
>
> ---------- Forwarded message ----------
> From: Matteo <[hidden email]>
> To: "Pharo is welcome (ML)" <[hidden email]>
> Cc:
> Date: Sat, 5 Nov 2016 16:10:45 +0100
> Subject: Speed up JPG images loading
> Dears,
>         I'm loading a lot of pictures (70) through the method
> "ImageReadWriter>>formFromFileNamed:".
> The method is very slow, with images bigger than 5MB.
>
>         Is there a way to improve the pictures speed loading?
>
>
> Thanks
> Matteo
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Speed up JPG images loading

matteob8
In reply to this post by Sven Van Caekenberghe-2
Hi Sven,
      my test are close to yours, so there's nothing wrong with my image.

      [ Form fromFileNamed: 'pharo.png' ] benchFor: 10 seconds.

       "a BenchmarkResult(708 iterations in 10 seconds 4 milliseconds. 70.772 per second)"


      In case, I'll follow your hint to resort to Fuel.

      BTW I'm using Pharo5.0, Latest update: #50761, on a Linux machine


Thanks,
Matteo
Reply | Threaded
Open this post in threaded view
|

Re: Speed up JPG images loading

Pharo Smalltalk Users mailing list
In reply to this post by Sven Van Caekenberghe-2
Hi Sven,
      my test are close to yours, so there's nothing wrong with my image.

      [ Form fromFileNamed: 'pharo.png' ] benchFor: 10 seconds.

       "a BenchmarkResult(708 iterations in 10 seconds 4 milliseconds.
70.772 per second)"


      In case, I'll follow your hint to resort to Fuel.

      BTW I'm using Pharo5.0, Latest update: #50761, on a Linux machine


Thanks,
Matteo



--
View this message in context: http://forum.world.st/Speed-up-JPG-images-loading-tp4921772p4922093.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.