Pushing Pixels (was Game Programming)

Eric Scharff Eric.Scharff at Colorado.EDU
Thu Nov 1 01:06:57 UTC 2001


How fast is "fast enough"?

I agree that pixel pushing ~= good gaming.  But how much pixel pushing
could be done in Squeak?

I decided to play with graphics and wrote a simple benchmark - roll the
screen:

| w h r copyTop scrollUp |
Display restoreAfter: [
w _ Display width.
h _ Display height.
r _ Display boundingBox.
copyTop _ BitBlt
	destForm: Display sourceForm: Display halftoneForm: nil
	combinationRule: 3 destOrigin: 0@(h-10) sourceOrigin: 0 at 0 extent: w at 10
	clipRect: r.
scrollUp _ BitBlt
	destForm: Display sourceForm: Display halftoneForm: nil
	combinationRule: 3 destOrigin: 0 at 0 sourceOrigin: 0 at 10 extent: w@(h-10)
	clipRect: r.
h // 10 - 1 timesRepeat: [
	copyTop copyBits.
        scrollUp copyBits.]]

OK, its silly, but I like watching it. :)

This takes around 1.5 seconds in 16 bit color at 800x600 on my G3/233.
Speed seems to vary considerably.  It runs very well on my B&W G3, but
really terribly on just a somewhat slower machine (PowerMac 8500).

For kicks, I wrote the same code in C on the Mac (using the
presumably-accelerated Toolbox CopyBits() function).  It runs perhaps 4
times faster, which is nice, but certainly not an order of magnitude.

Is there a way to do this faster?  Is it fast enough?

-Eric





More information about the Squeak-dev mailing list