[gambit-list] performance

Andrew Reilly areilly at bigpond.net.au
Tue Apr 20 02:25:22 EDT 2010


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



More information about the Gambit-list mailing list