benchmarking display speed? Speedups for little-endian machines...

Ned Konz ned at bike-nomad.com
Sun Jul 23 16:16:54 UTC 2000


Has anyone got some code to benchmark the speed of drawing the display to the
screen?
I suppose I could just force it to update repeatedly... what's the best way to
do this?

I was looking at the byte swapping code in the VM... is is really necessary
to swap bytes for every display?

(Perhaps we should change the byte sex in the image to be little-endian to match
the majority of the machines running Squeak)

Right now the byte swapping code looks like (copyReverseImageBytes):

    register unsigned char *from= (unsigned char
*)((int)fromImageData+firstWord);
    register unsigned char *limit= (unsigned char
*)((int)fromImageData+lastWord);
    register unsigned char *to= (unsigned char *)((int)toImageData+firstWord);
 
    while (from < limit)
      {
	to[0]= from[3];
	to[1]= from[2];
	to[2]= from[1];
	to[3]= from[0];
	from+= 4;
	to+= 4;
      }

which generates a number of memory accesses.

It seems like this would be faster (we can let GCC worrry about register
allocation):

    unsigned int *from= (unsigned int *)((int)fromImageData+firstWord);
    unsigned int *limit= (unsigned int *)((int)fromImageData+lastWord);
    unsigned int *to= (unsigned int *)((int)toImageData+firstWord);
 
    while (from < limit)
      {
	unsigned int bytes = *from++;
	*to++ = ((((bytes) & 0x000000ffU) << 24) |
		(((bytes) & 0x0000ff00U) <<  8) |
		(((bytes) & 0x00ff0000U) >>  8) |
		(((bytes) & 0xff000000U) >> 24));
      }

and I wanted to try it.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list