Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Unified Diff: src/main.cpp

Issue 1738683003: Subzero. Moar performance tweaks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/IceBitVector.h ('K') | « src/IceTypes.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/main.cpp
diff --git a/src/main.cpp b/src/main.cpp
index 9e2a6ecf32d6f5f7d31c97162d457ddc2c6816fe..baaa39ef8adc0cbf17e2ae0021ff1f073b05a3f4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,6 +17,10 @@
#include "IceBuildDefs.h"
#include "IceCompileServer.h"
+#ifdef __pnacl__
+#include <malloc.h>
+#endif // __pnacl__
+
/// Depending on whether we are building the compiler for the browser or
/// standalone, we will end up creating a Ice::BrowserCompileServer or
/// Ice::CLCompileServer object. Method
@@ -26,6 +30,15 @@
/// We can only compile the Ice::BrowserCompileServer object with the PNaCl
/// compiler toolchain, when building Subzero as a sandboxed translator.
int main(int argc, char **argv) {
+#ifdef __pnacl__
+#define M_GRANULARITY (-2)
+ // PNaCl's default malloc implementation grabs small chunks of memory with
+ // mmap at a time, hence causing significant slowdowns. This call ensures that
+ // mmap is used to allocate 16MB at a time, to amortize the system call cost.
+ mallopt(M_GRANULARITY, 16 * 1024 * 1024);
+#undef M_GRANULARITY
+#endif // __pnacl__
+
if (Ice::BuildDefs::browser()) {
assert(argc == 1);
return Ice::BrowserCompileServer().runAndReturnErrorCode();
« src/IceBitVector.h ('K') | « src/IceTypes.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698