PNG Performance (was Re: [BUG] Scamper...)

Bob Arning arning at charm.net
Fri Nov 3 23:47:13 UTC 2000


Hi Duane,

The original time for processing the form (http://www.startrip.dhs.org/images/background.png) that Ian Trudel uses on his web page was 28 seconds on my machine. My first, quick change reduced that to 16. Eric's changes (which replaced mine) reduced it to 6. Taking a look at Eric's, I was able to reduce that to 3. We are now at the point that the zlib decompression takes over half the time. I have included my change below and I suspect that it would help in some of the other (perhaps less common) modes.

Cheers,
Bob


=====code follows=====
'From Squeak2.9alpha of 17 July 2000 [latest update: #2944] on 3 November 2000 at 6:35:06 pm'!

!PNGReadWriter methodsFor: 'pixel copies' stamp: 'RAA 11/3/2000 18:34'!
copyPixelsRGB: y
	"Handle non-interlaced RGB color mode (colorType = 2)"

	| i pixel tempForm tempBits |

	tempForm _ Form extent: width at 1 depth: 32.
	tempBits _ tempForm bits.
	pixel := LargePositiveInteger new: 4.
	pixel at: 4 put: 16rFF.
	bitsPerChannel = 8
		ifTrue: [
			i := -2.
			0 to: width-1 do: [ :x |
				i _ i + 3.
				pixel
					at: 3 put: (thisScanline at: i);
					at: 2 put: (thisScanline at: i+1);
					at: 1 put: (thisScanline at: i+2).
				tempBits at: x+1 put: pixel.
				]
			]
		ifFalse: [
			i := -5.
			0 to: width-1 do: [ :x |
				i _ i + 6.
				pixel
					at: 3 put: (thisScanline at: i);
					at: 2 put: (thisScanline at: i+2);
					at: 1 put: (thisScanline at: i+4).
				tempBits at: x+1 put: pixel.
				]
			].
	tempForm displayOn: form at: 0 at y.

! !
===========

On Fri, 3 Nov 2000 11:40:10 -0800 Duane Maxwell <dmaxwell at exobox.com> wrote:
>>On the speed issue, 2.8 ignored the PNG you have as a background. 2.9 renders
>>it, but slowly. I have added an update to the disney internal stream that
>>gives a 40% improvement in this case. It will be available in the near
>>future. Note: there may be other opportunities for speed improvements
>>in PNG if anyone is interested in something to do.
>
>Bob -
>
>Eric Arseneau did some basic improvements to PNG performance internally
>which I believe he released to the list back in the middle of September - I
>think it bought us a doubling in performance.  I also have written, but not
>tested completely, a plugin which accelerates much of the decoding of the
>most common depth/compression combinations.  Unfortunately, I have yet to
>merge my changes with Eric's, and I know we collide.  Some of our message
>tallies indicate there may be a speed limit due to the implementation of
>Squeak's zlib decompression, which is currently outside the scope of the
>PNG reader.
>
>If you have any other specific pointers to performance problems in PNG, I'd
>like to take a look at them.  I'd also like to merge your changes in with
>ours, so if you could see your way clear to forwarding them, I'd appreciate
>it.  Our system is increasingly dependent upon PNG, and it's an identified
>bottleneck.





More information about the Squeak-dev mailing list