[ENH] Faster BMP writing

Yoshiki Ohshima Yoshiki.Ohshima at acm.org
Thu Feb 19 02:40:54 UTC 2004


  Hello,

  Lately, I'm generating thousands of BMP files.

  It seems that there was some attempt to make a primitive for it, but
the one in the VMMaker doesn't seem to be complete and the primitive
only handles depth=32 Forms, which doesn't serve my purpose because
the BMP I'm interested in happens to be 8 bit.

  So, I did a little hack to speed up the BMP writing.  With this
changeset, writing a 720x480x8 Form to a byte array as BMP becomes 30
times faster.

-----------------
f _ Form extent: 720 at 480 depth: 8.
bytes _ ByteArray new: 500000.
[100 timesRepeat: [
	w _ WriteStream on: bytes.
	b _ BMPReadWriter on: w.
	b nextPutImage: f.
]] timeToRun.
-----------------

  This changeset factors out the depth=32 case.  Presumably, it should
make it easier to adapt the BMP writing primitive.

-- Yoshiki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FasterBMPWriter.cs.gz
Type: application/octet-stream
Size: 2419 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040218/bfecf232/FasterBMPWriter.cs.obj


More information about the Squeak-dev mailing list