Re: [AD] malloc

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


On Saturday 19 November 2005 09:20 pm, aj wrote:
> As it stands at the moment, allegro can be severly performance hit, if
> someone compiles it with SSE turned on, P4, and AMD CPUs both have SSE.

Have you tried enabling SSE to test the performance hit? And if so, do you 
know if it's not just from improper SSE code use, or due to improper memory 
alignment? Do you know if GCC/MSVC don't already optimize malloc calls to 
return aligned pointers when SSE is being used?

Besides, I thought we already talked about this on IRC and such. Memory 
bitmaps and samples and such won't benefit from aligned allocation since even 
if the pointer is aligned, each value within will not be (eg. if
bmp->line[0][0] is an aligned access, ((uint32_t*)bmp->line[0])[1] won't be, 
etc). Plus, you can't gaurantee the alignment of video bitmaps since the 
system allocates/maps them, not your program.

Personally, I don't see why GCC would generate SSE code to use on dereferenced 
pointers (which it'll almost never know at compile time if they're aligned or 
not). Instead, it probably would only use SSE code to use on the variables 
themselves, where it'll know for certain if it will be properly aligned or 
not.

> Intel are now recommending that code favour SSE instead of MMX (cpu
> manufacturers have already signalled the death of MMX)

MMX won't disappear from processors. There are programs that require an 
MMX-compatible CPU, and such programs would become unrunable if MMX went 
away. And it's only natural that Intel would favour SSE over MMX. SSE is 
newer, and probably better than MMX (and it gives users more of an incentive 
to buy a newer CPU if they still have old ones).




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