[llvm] de1d4eb - [memprof] Omit the key length for the call stack table (#89510)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 20 18:50:16 PDT 2024
Author: Kazu Hirata
Date: 2024-04-20T18:50:13-07:00
New Revision: de1d4eb06bc22834fe8008769b4c9344a0a8330f
URL: https://github.com/llvm/llvm-project/commit/de1d4eb06bc22834fe8008769b4c9344a0a8330f
DIFF: https://github.com/llvm/llvm-project/commit/de1d4eb06bc22834fe8008769b4c9344a0a8330f.diff
LOG: [memprof] Omit the key length for the call stack table (#89510)
The call stack table has a constant key length, so we don't need to
serialize or deserialize it for every key-data pair. Omitting the key
length saves 0.64% of the indexed MemProf file size.
Note that it's OK to change the format because Version2 is still under
development.
Added:
Modified:
llvm/include/llvm/ProfileData/MemProf.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h
index 59ef59fd33a3ff..aa6cdf198485b0 100644
--- a/llvm/include/llvm/ProfileData/MemProf.h
+++ b/llvm/include/llvm/ProfileData/MemProf.h
@@ -652,8 +652,8 @@ class CallStackWriterTrait {
EmitKeyDataLength(raw_ostream &Out, key_type_ref K, data_type_ref V) {
using namespace support;
endian::Writer LE(Out, llvm::endianness::little);
+ // We do not explicitly emit the key length because it is a constant.
offset_type N = sizeof(K);
- LE.write<offset_type>(N);
offset_type M = sizeof(FrameId) * V.size();
LE.write<offset_type>(M);
return std::make_pair(N, M);
@@ -697,8 +697,8 @@ class CallStackLookupTrait {
ReadKeyDataLength(const unsigned char *&D) {
using namespace support;
- offset_type KeyLen =
- endian::readNext<offset_type, llvm::endianness::little>(D);
+ // We do not explicitly read the key length because it is a constant.
+ offset_type KeyLen = sizeof(external_key_type);
offset_type DataLen =
endian::readNext<offset_type, llvm::endianness::little>(D);
return std::make_pair(KeyLen, DataLen);
More information about the llvm-commits
mailing list