[gambit-list] performance
Álvaro Castro-Castilla
alvaro.castro.castilla at gmail.com
Tue Apr 20 05:54:22 EDT 2010
El 20 de abril de 2010 08:25, Andrew Reilly <areilly at bigpond.net.au>escribió:
> Sorry for coming in late!
>
> I don't think that your C program is doing what you thing it should be.
> Certainly not
> what your list-based scheme program is. Specifically, the array indexing
> in :
>
> for (j=0; j< size_y; j++) {
> for (i=0; i< size_x; i++) {
> p.x = i;
> p.y = j;
> dist = distance_point_point(&p, &refp);
> if ( dist > 255 ) {
> block[i*j] = 255;
> } else {
> block[i*j] = dist;
> }
> }
> }
>
> should probably be block[j*size_x + i]. What you have there is
> only setting a very limited subset of the elements of the array.
>
> Cheers,
>
> --
> Andrew
>
Yes you are right about that and I realized later. I wrote that stuff very
quickly just to measure times. I made the same mistake in the scheme code
also IRCC :)
Thanks for you reply!
Álvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20100420/553af941/attachment.htm>
More information about the Gambit-list
mailing list