[squeak-dev] Re: quick handling of graphics files
Ross Boylan
ross at biostat.ucsf.edu
Wed Apr 14 19:28:22 UTC 2010
On Tue, 2010-04-13 at 21:05 -0700, Andreas Raab wrote:
> Hi Ross -
>
> Profiling is your friend. In most cases, 95% of the time are spent in 5%
> of the code. From what you're saying below it sounds that you're using
> one of the 'special' PNG modes (black and white, or gray-scale) that
> probably have seen less attention for optimization than others. Any
> chance you can post a sample image for profiling it?
>
> Cheers,
> - Andreas
Here are the results. I got a code simulation error when I tried
tallyOn. I'm using pharo-vm-0.15.2d-linux/squeak as the VM.
Aside from the PNG being 1 bit it is high resolution (400dpi) and the
displayed image is larger than the entire smalltalk window (or my
screen, I think).
World extent -> 1704 at 1093
MessageTally spyOn: [(ImageReadWriter formFromFileNamed:
'/home/boylan/ScanImages/Medical/test.png') asMorph openInHand ]
except this was done with my original, larger image.
BTW, couldn't find a way to paste or fileout the results of
TimeProfileBrowser.
- 53894 tallies, 53969 msec.
**Tree**
100.0% {53969ms} ImageReadWriter class>>formFromFileNamed:
100.0% {53969ms} ImageReadWriter class>>formFromStream:
100.0% {53969ms} PNGReadWriter>>nextImage
100.0% {53969ms} PNGReadWriter>>processIDATChunk
100.0% {53969ms} PNGReadWriter>>processNonInterlaced
97.9% {52836ms} PNGReadWriter>>copyPixelsGray:
43.0% {23207ms} BitBlt>>pixelAt:put:
|25.3% {13654ms} Form>>unhibernate
| |12.8% {6908ms} primitives
| |12.5% {6746ms} Bitmap(Object)>>isMemberOf:
|17.8% {9606ms} primitives
27.8% {15003ms} SmallInteger>>=
|14.5% {7826ms} primitives
|13.3% {7178ms} SmallInteger(Integer)>>=
13.9% {7502ms} primitives
13.1% {7070ms} SmallInteger(Integer)>>>>
**Leaves**
17.8% {9606ms} BitBlt>>pixelAt:put:
14.5% {7826ms} SmallInteger>>=
13.9% {7502ms} PNGReadWriter>>copyPixelsGray:
13.3% {7178ms} SmallInteger(Integer)>>=
13.1% {7070ms} SmallInteger(Integer)>>>>
12.8% {6908ms} Form>>unhibernate
12.5% {6746ms} Bitmap(Object)>>isMemberOf:
**Memory**
old +0 bytes
young +3,823,212 bytes
used +3,823,212 bytes
free -3,823,212 bytes
**GCs**
full 0 totalling 0ms (0.0% uptime)
incr 4281 totalling 1,469ms (3.0% uptime), avg 0.0ms
tenures 0
root table 0 overflows
>
> On 4/13/2010 6:37 PM, Ross Boylan wrote:
> > I have PNG files with document scans, and would like to view them as
> > part of an application. I will also need to scale and/or pan them.
> >
> > One file took over a minute to open when I selected "open graphic in
> > window" from the file browser. (ImageReadWriter formFromFileNamed:
> > 'myfile.png') asMorph openInHand had about the same speed.
> >
> > I'm looking for advice on how to speed that up, or the information that
> > is not possible. I found a similar question on the newbie list, but no
> > one answered it.
> >
> > I'm guessing that it is the initial read and translation of the file
> > that's taking the time, since resizing the image is much faster than
> > loading it.
> >
> > This is really too slow to be practical, and much slower than
> > imagemagick's display command, which opens in under 5 seconds.
> >
> > The image is a 400dpi black and white scan of an 8.5x11" page; the file
> > is 144k bytes.
> >
> > BTW is there any particular reason the file browser opens a SketchMorph
> > while asMorph on the ImageReadWrite result produces an ImageMorph? The
> > former is closer to what I want since it is resizeable and not
> > transluscent; on the other hand, the comment in SketchMorph says they
> > are produced by the PaintBox, which is not true in this case.
> >
> > Squeak 3.10.2 on Linux with 32 bit color in X. I think squeak is using
> > 32 bit color as well, but couldn't find the setting on a quick look (not
> > in preferences browser).
> >
> >
> >
>
>
More information about the Squeak-dev
mailing list
|