aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorpzhang <pzhang@mozilla.com>2013-07-31 10:32:44 +0800
committerpzhang <pzhang@mozilla.com>2013-07-31 10:32:44 +0800
commitad2bd9af8354849c88254dc01f20fd96549a796f (patch)
treeba88e996f6d37966f9bf3a2fc027a3471e7cc3a7 /src/library.js
parent61526bc8b6eca8950e34616fc9cad2212c18abe6 (diff)
Reduce call chain of qsort
This will considerably improve the performance of qsort-heavily-used projects like Android-Pinyin-IME, more discussion: https://groups.google.com/forum/#!topic/emscripten-discuss/Ah2CNfQ8ra4 https://github.com/kripken/emscripten/pull/1437
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index f7c7a3ba..28886671 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4181,7 +4181,11 @@ LibraryManager.library = {
var keys = [];
for (var i = 0; i < num; i++) keys.push(i);
keys.sort(function(a, b) {
- return comparator(base+a*size, base+b*size);
+#if ASM_JS
+ return Module['dynCall_iii'](cmp, base+a*size, base+b*size);
+#else
+ return FUNCTION_TABLE[cmp](base+a*size, base+b*size);
+#endif
});
// apply the sort
var temp = _malloc(num*size);