[Webkit-unassigned] [Bug 100754] Faster sorting of numeric arrays

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 12 16:07:06 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=100754





--- Comment #14 from Cosmin Truta <ctruta at gmail.com>  2012-11-12 16:08:49 PST ---
Created an attachment (id=173750)
 --> (https://bugs.webkit.org/attachment.cgi?id=173750&action=review)
C++ micro-benchmark

(In reply to comment #12)
> We actually use libc++ on the Mac.

I finally tried the attached C++ micro-benchmark on a Mac running OS X 10.7.5, Xcode 4.4.1, using both clang++ and g++ at -O3, and using both libc++ and GNU STL.
When applied to int[] arrays with 16 million elements, std::sort using function objects beat qsort by approx. 3x (seriously!). On double[] arrays, std::sort beat qsort by approx. 2.5x.
Moreover, there was a noticeable difference between std::sort'ing with function objects vs. function pointers. Although the latter was slower, the function-pointer-driven specialization of std::sort still beat the function-pointer-driven qsort by approx. 1.8x. YYMV.

In conclusion, std::sort beats qsort significantly -- especially on the Mac.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list