On Thursday, January 26, 2012 6:46:30 PM UTC+8, Nathann Cohen wrote: > > > Actually, newer Intel and AMD processors (I guess, ARM too) have POPCNT > > wired in, so __builtin_popcount(), which is a gcc function, will beat > your > > implementation, as time goes by. > > Yep but there's a function call "becase" it is a function, while the > current one is inlined. I really have no idea how much time is spent > on that though. > > The other detail is that even when available on the computer the > __builtin_popcount is not automatically replaced by the corresponding > instruction -- at least it was not on my former tests. To force it, I > had to add a flag to the top of the Cython file, to force the compiler > to use the -mpopcnt option. But of course if we do this on a computer > that does not support the instruction.... ---> BOOM :-p > I'm sure this is configurable, and it should be configured, when building Sage.
And, calling a (very fast) function is faster than using your code, anyway, IMHO. > Nathann > > -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org