forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure MemoryUsageStats.maxBytes is always valid
In SmartAllocator.alloc() we execute if (hhvm) .. if (m_stats.maxBytes > 0) on every smart allocation, which is a very hot path. We can eliminte this check by just ensuring maxBytes is always valid (use MAX_INT64 instead of 0 or -1 to suppress the check). Perflab says this saves about 1% CPU time, just above the noise margin, but CPU instructions are measurably down and it's obviously good to streamline the allocator hot path.
- Loading branch information
1 parent
17dfa43
commit aa63830
Showing
5 changed files
with
19 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,13 @@ | |
| [email protected] so we can mail you a copy immediately. | | ||
+----------------------------------------------------------------------+ | ||
*/ | ||
// Get SIZE_MAX definition. Do this before including any other files, to make | ||
// sure that this is the first place that stdint.h is included. | ||
#ifndef __STDC_LIMIT_MACROS | ||
#define __STDC_LIMIT_MACROS | ||
#endif | ||
#define __STDC_LIMIT_MACROS | ||
#include <stdint.h> | ||
|
||
#include <runtime/base/runtime_option.h> | ||
#include <runtime/base/type_conversions.h> | ||
|
@@ -107,7 +114,7 @@ bool RuntimeOption::PageletServerThreadDropStack = false; | |
int RuntimeOption::FiberCount = 1; | ||
int RuntimeOption::RequestTimeoutSeconds = 0; | ||
size_t RuntimeOption::ServerMemoryHeadRoom = 0; | ||
int64 RuntimeOption::RequestMemoryMaxBytes = -1; | ||
int64 RuntimeOption::RequestMemoryMaxBytes = INT64_MAX; | ||
int64 RuntimeOption::ImageMemoryMaxBytes = 0; | ||
int RuntimeOption::ResponseQueueCount; | ||
int RuntimeOption::ServerGracefulShutdownWait; | ||
|
@@ -665,7 +672,7 @@ void RuntimeOption::Load(Hdf &config, StringVec *overwrites /* = NULL */, | |
ServerStatCache = server["StatCache"].getBool(true); | ||
RequestTimeoutSeconds = server["RequestTimeoutSeconds"].getInt32(0); | ||
ServerMemoryHeadRoom = server["MemoryHeadRoom"].getInt64(0); | ||
RequestMemoryMaxBytes = server["RequestMemoryMaxBytes"].getInt64(-1); | ||
RequestMemoryMaxBytes = server["RequestMemoryMaxBytes"].getInt64(INT64_MAX); | ||
ResponseQueueCount = server["ResponseQueueCount"].getInt32(0); | ||
if (ResponseQueueCount <= 0) { | ||
ResponseQueueCount = ServerThreadCount / 10; | ||
|