Hi Matteo,
On 5 Nov 2016, at 16:11, Matteo via Pharo-users <pharo-users@lists.pharo.org> wrote:
From: Matteo <matteob8@yahoo.it> Subject: Speed up JPG images loading Date: 5 November 2016 at 16:10:45 GMT+1 To: "Pharo is welcome (ML)" <pharo-users@lists.pharo.org>
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
I found a reference to a similar discussion from the past: https://pharo.fogbugz.com/f/cases/17403/Creating-Forms-from-PNGs-is-very-slo... 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 <sven@stfx.eu> wrote:
Hi Matteo,
On 5 Nov 2016, at 16:11, Matteo via Pharo-users <pharo-users@lists.pharo.org> wrote:
From: Matteo <matteob8@yahoo.it> Subject: Speed up JPG images loading Date: 5 November 2016 at 16:10:45 GMT+1 To: "Pharo is welcome (ML)" <pharo-users@lists.pharo.org>
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
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.
participants (2)
-
matteob8 -
Sven Van Caekenberghe