diff options
author | Michal Strehovsky <michals@microsoft.com> | 2017-08-14 20:59:13 +0300 |
---|---|---|
committer | Michal Strehovsky <michals@microsoft.com> | 2017-08-14 20:59:13 +0300 |
commit | 1e9054a91177eed92094790ae063a4d741185aa2 (patch) | |
tree | 2b37c7212aed534b66c9843b8cf2b86c0c24925b /src/Native/Runtime/windows | |
parent | d714e3be0bb99c0f76f3b62ce310878be0b3f66e (diff) |
Speed up string allocations by 35%
`FastAllocateString` (the choke point through which all string allocations go through) wasn't as fast as it could be and we were 30% slower than CLR on allocating strings. We were leaving a lot of perf on the table.
Before this change, string allocation was using the same allocator as arrays. Since there's a subtle difference between the failure modes on overflow (string allocation throws OOM, array allocation throws OverflowException), `FastAllocateString` required a try/catch block to handle the corner case. This was inhibiting codegen optimizations around this code path - to fix that problem, we needed a separate allocator. And since we now had a separate allocator for strings, I also took the liberty of inlining some details around strings (component size and base size) into the helper. It turns out runtime already hardcodes the details around strings (the component size) in a couple places anyway, so this is not that big of a "separation of concerns" violation as it looks like.
[tfs-changeset: 1670224]
Diffstat (limited to 'src/Native/Runtime/windows')
-rw-r--r-- | src/Native/Runtime/windows/AsmOffsets.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Native/Runtime/windows/AsmOffsets.cpp b/src/Native/Runtime/windows/AsmOffsets.cpp index 468419aa4..a76400235 100644 --- a/src/Native/Runtime/windows/AsmOffsets.cpp +++ b/src/Native/Runtime/windows/AsmOffsets.cpp @@ -3,9 +3,10 @@ // See the LICENSE file in the project root for more information. #ifdef _ARM_ -#define PLAT_ASM_OFFSET(offset, cls, member) OFFSETOF__##cls##__##member equ 0x##offset -#define PLAT_ASM_SIZEOF(size, cls ) SIZEOF__##cls equ 0x##size -#define PLAT_ASM_CONST(constant, expr) expr equ 0x##constant +#define HASH_DEFINE #define +#define PLAT_ASM_OFFSET(offset, cls, member) HASH_DEFINE OFFSETOF__##cls##__##member 0x##offset +#define PLAT_ASM_SIZEOF(size, cls ) HASH_DEFINE SIZEOF__##cls 0x##size +#define PLAT_ASM_CONST(constant, expr) HASH_DEFINE expr 0x##constant #else |