Reduce QuicConfig size from 1432 bytes to 1160 bytes by better padding.
// Before
sizeof(QuicConfigValue) = 16
sizeof(QuicFixedUint32) = 32
sizeof(QuicFixedUint62) = 48
sizeof(QuicFixedUint128) = 64
sizeof(QuicFixedTagVector) = 80
sizeof(QuicFixedSocketAddress) = 72
sizeof(QuicConfig) = 1432
// After
sizeof(QuicConfigValue) = 16
sizeof(QuicFixedUint32) = 24
sizeof(QuicFixedUint62) = 32
sizeof(QuicFixedUint128) = 48
sizeof(QuicFixedTagVector) = 64
sizeof(QuicFixedSocketAddress) = 64
sizeof(QuicConfig) = 1160
PiperOrigin-RevId: 338664457
Change-Id: I828e2f900d493277832223df0a507bd77ceb8c89
diff --git a/quic/core/quic_config.h b/quic/core/quic_config.h
index 0fa3a1e..016d5d0 100644
--- a/quic/core/quic_config.h
+++ b/quic/core/quic_config.h
@@ -27,7 +27,7 @@
// Describes whether or not a given QuicTag is required or optional in the
// handshake message.
-enum QuicConfigPresence {
+enum QuicConfigPresence : uint8_t {
// This negotiable value can be absent from the handshake message. Default
// value is selected as the negotiated value in such a case.
PRESENCE_OPTIONAL,
@@ -91,10 +91,10 @@
std::string* error_details) override;
private:
- uint32_t send_value_;
bool has_send_value_;
- uint32_t receive_value_;
bool has_receive_value_;
+ uint32_t send_value_;
+ uint32_t receive_value_;
};
// Stores 62bit numbers from handshake messages that unilaterally shared by each
@@ -128,10 +128,10 @@
std::string* error_details) override;
private:
- uint64_t send_value_;
bool has_send_value_;
- uint64_t receive_value_;
bool has_receive_value_;
+ uint64_t send_value_;
+ uint64_t receive_value_;
};
// Stores uint128 from CHLO or SHLO messages that are not negotiated.
@@ -161,10 +161,10 @@
std::string* error_details) override;
private:
- QuicUint128 send_value_;
bool has_send_value_;
- QuicUint128 receive_value_;
bool has_receive_value_;
+ QuicUint128 send_value_;
+ QuicUint128 receive_value_;
};
// Stores tag from CHLO or SHLO messages that are not negotiated.
@@ -197,10 +197,10 @@
std::string* error_details) override;
private:
- QuicTagVector send_values_;
bool has_send_values_;
- QuicTagVector receive_values_;
bool has_receive_values_;
+ QuicTagVector send_values_;
+ QuicTagVector receive_values_;
};
// Stores QuicSocketAddress from CHLO or SHLO messages that are not negotiated.
@@ -228,10 +228,10 @@
std::string* error_details) override;
private:
- QuicSocketAddress send_value_;
bool has_send_value_;
- QuicSocketAddress receive_value_;
bool has_receive_value_;
+ QuicSocketAddress send_value_;
+ QuicSocketAddress receive_value_;
};
// QuicConfig contains non-crypto configuration options that are negotiated in