Re: [AD] minor issues

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Julien Cugnière wrote:

What would really be an improvement is if memcpy was faster than blit... who knows :-)


hehe, I do. memcpy is *much* faster that draw_sprite for 24-bit bitmaps. Ratio of sums of 3 consecutive test:

    draw_sprite            memcpy
(5.155+5.145+5.155) / (2.63+2.655+2.7) = 0.5166

Other color depths favor draw_sprite. This realy make you think...


int main() {
        int c;
        int t;
        BITMAP *bmp, *bmp1;
        const int iter = 2000;

        allegro_init();

        bmp = create_bitmap_ex(24, 800, 600);
        bmp1 = create_bitmap_ex(24, 800, 600);

        t = clock();
        for (c = 0; c < iter; ++c)
memcpy(bmp->line[0], bmp1->line[0], BYTES_PER_PIXEL(bitmap_color_depth(bmp)) * bmp->w * bmp->h);
                //draw_sprite(bmp, bmp1, 0, 0);
        t = clock() - t;
printf("24-bit: %i calls, %f ms per call\n", iter, 1000.0 * t / (iter * (double)CLOCKS_PER_SEC));
        destroy_bitmap(bmp);
        destroy_bitmap(bmp1);

        return 0;
}
END_OF_MAIN()


--
Milan Mimica






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/