diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-07-26 03:33:15 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-07-27 09:39:26 +0000 |
commit | 006f5d16fd9e5a4010c0b1068a7b96fa35136a8c (patch) | |
tree | ea4341408151483e6f9cc7a4d960fa39683922d5 /vespalib/src | |
parent | 2b43a46817cc779dccedd82ea8460802367a448a (diff) |
- Pack data closer to let config fit in 2 cache lines instead of 4.
- Avoid plt indirection and allow more inlining of frequently called code.
- Reapplication of #27646
Diffstat (limited to 'vespalib/src')
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp | 8 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/compaction_strategy.h | 53 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/text/lowercase.h | 4 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/text/utf8.cpp | 39 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/text/utf8.h | 47 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/alloc.cpp | 4 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/alloc.h | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/growstrategy.h | 9 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/small_vector.h | 2 |
10 files changed, 80 insertions, 95 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp index 4eb4ff16864..eea49e80135 100644 --- a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp +++ b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp @@ -10,19 +10,19 @@ namespace vespalib::datastore { bool -CompactionStrategy::should_compact_memory(const MemoryUsage& memory_usage) const +CompactionStrategy::should_compact_memory(const MemoryUsage& memory_usage) const noexcept { return should_compact_memory(memory_usage.usedBytes(), memory_usage.deadBytes()); } bool -CompactionStrategy::should_compact_address_space(const AddressSpace& address_space) const +CompactionStrategy::should_compact_address_space(const AddressSpace& address_space) const noexcept { return should_compact_address_space(address_space.used(), address_space.dead()); } CompactionSpec -CompactionStrategy::should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const +CompactionStrategy::should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const noexcept { return CompactionSpec(should_compact_memory(memory_usage), should_compact_address_space(address_space)); } @@ -36,7 +36,7 @@ std::ostream& operator<<(std::ostream& os, const CompactionStrategy& compaction_ } CompactionStrategy -CompactionStrategy::make_compact_all_active_buffers_strategy() +CompactionStrategy::make_compact_all_active_buffers_strategy() noexcept { return CompactionStrategy(0.0, 0.0, std::numeric_limits<uint32_t>::max(), 1.0); } diff --git a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h index f78e123e5de..c0c1857deae 100644 --- a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h +++ b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h @@ -25,15 +25,15 @@ public: static constexpr size_t DEAD_BYTES_SLACK = 0x10000u; static constexpr size_t DEAD_ADDRESS_SPACE_SLACK = 0x10000u; private: - double _maxDeadBytesRatio; // Max ratio of dead bytes before compaction - double _maxDeadAddressSpaceRatio; // Max ratio of dead address space before compaction + float _maxDeadBytesRatio; // Max ratio of dead bytes before compaction + float _maxDeadAddressSpaceRatio; // Max ratio of dead address space before compaction + float _active_buffers_ratio; // Ratio of active buffers to compact for each reason (memory usage, address space usage) uint32_t _max_buffers; // Max number of buffers to compact for each reason (memory usage, address space usage) - double _active_buffers_ratio; // Ratio of active buffers to compact for each reason (memory usage, address space usage) - bool should_compact_memory(size_t used_bytes, size_t dead_bytes) const { + bool should_compact_memory(size_t used_bytes, size_t dead_bytes) const noexcept { return ((dead_bytes >= DEAD_BYTES_SLACK) && (dead_bytes > used_bytes * getMaxDeadBytesRatio())); } - bool should_compact_address_space(size_t used_address_space, size_t dead_address_space) const { + bool should_compact_address_space(size_t used_address_space, size_t dead_address_space) const noexcept { return ((dead_address_space >= DEAD_ADDRESS_SPACE_SLACK) && (dead_address_space > used_address_space * getMaxDeadAddressSpaceRatio())); } @@ -41,40 +41,37 @@ public: CompactionStrategy() noexcept : _maxDeadBytesRatio(0.05), _maxDeadAddressSpaceRatio(0.2), - _max_buffers(1), - _active_buffers_ratio(0.1) - { - } - CompactionStrategy(double maxDeadBytesRatio, double maxDeadAddressSpaceRatio) noexcept + _active_buffers_ratio(0.1), + _max_buffers(1) + { } + CompactionStrategy(float maxDeadBytesRatio, float maxDeadAddressSpaceRatio) noexcept : _maxDeadBytesRatio(maxDeadBytesRatio), _maxDeadAddressSpaceRatio(maxDeadAddressSpaceRatio), - _max_buffers(1), - _active_buffers_ratio(0.1) - { - } - CompactionStrategy(double maxDeadBytesRatio, double maxDeadAddressSpaceRatio, uint32_t max_buffers, double active_buffers_ratio) noexcept + _active_buffers_ratio(0.1), + _max_buffers(1) + { } + CompactionStrategy(float maxDeadBytesRatio, float maxDeadAddressSpaceRatio, uint32_t max_buffers, float active_buffers_ratio) noexcept : _maxDeadBytesRatio(maxDeadBytesRatio), _maxDeadAddressSpaceRatio(maxDeadAddressSpaceRatio), - _max_buffers(max_buffers), - _active_buffers_ratio(active_buffers_ratio) - { - } - double getMaxDeadBytesRatio() const { return _maxDeadBytesRatio; } - double getMaxDeadAddressSpaceRatio() const { return _maxDeadAddressSpaceRatio; } + _active_buffers_ratio(active_buffers_ratio), + _max_buffers(max_buffers) + { } + float getMaxDeadBytesRatio() const noexcept { return _maxDeadBytesRatio; } + float getMaxDeadAddressSpaceRatio() const noexcept { return _maxDeadAddressSpaceRatio; } uint32_t get_max_buffers() const noexcept { return _max_buffers; } - double get_active_buffers_ratio() const noexcept { return _active_buffers_ratio; } - bool operator==(const CompactionStrategy & rhs) const { + float get_active_buffers_ratio() const noexcept { return _active_buffers_ratio; } + bool operator==(const CompactionStrategy & rhs) const noexcept { return (_maxDeadBytesRatio == rhs._maxDeadBytesRatio) && (_maxDeadAddressSpaceRatio == rhs._maxDeadAddressSpaceRatio) && (_max_buffers == rhs._max_buffers) && (_active_buffers_ratio == rhs._active_buffers_ratio); } - bool operator!=(const CompactionStrategy & rhs) const { return !(operator==(rhs)); } + bool operator!=(const CompactionStrategy & rhs) const noexcept { return !(operator==(rhs)); } - bool should_compact_memory(const MemoryUsage& memory_usage) const; - bool should_compact_address_space(const AddressSpace& address_space) const; - CompactionSpec should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const; - static CompactionStrategy make_compact_all_active_buffers_strategy(); + bool should_compact_memory(const MemoryUsage& memory_usage) const noexcept; + bool should_compact_address_space(const AddressSpace& address_space) const noexcept; + CompactionSpec should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const noexcept; + static CompactionStrategy make_compact_all_active_buffers_strategy() noexcept; }; std::ostream& operator<<(std::ostream& os, const CompactionStrategy& compaction_strategy); diff --git a/vespalib/src/vespa/vespalib/text/lowercase.h b/vespalib/src/vespa/vespalib/text/lowercase.h index dc081c6ba2d..5c4e3e34e07 100644 --- a/vespalib/src/vespa/vespalib/text/lowercase.h +++ b/vespalib/src/vespa/vespalib/text/lowercase.h @@ -43,9 +43,9 @@ public: * @param codepoint the character codepoint to be lowercased. * @return lowercase UCS-4 character (codepoint if no lowercasing is performed). **/ - static uint32_t convert(uint32_t codepoint) + static uint32_t convert(uint32_t codepoint) noexcept { - if (codepoint < 0x100) { + if (codepoint < 0x100) [[likely]] { return lowercase_0_block[codepoint]; } else if (codepoint < 0x600) { return lowercase_0_5_blocks[codepoint]; diff --git a/vespalib/src/vespa/vespalib/text/utf8.cpp b/vespalib/src/vespa/vespalib/text/utf8.cpp index cae2bbae682..c950f62985f 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.cpp +++ b/vespalib/src/vespa/vespalib/text/utf8.cpp @@ -16,18 +16,16 @@ void Utf8::throwX(const char *msg, unsigned int number) throw IllegalArgumentException(what); } -uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback) +uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept { if (_pos == size()) { // this shouldn't happen ... - LOG(warning, "last byte %02X of Utf8Reader block was incomplete UTF-8", - firstbyte); + LOG(warning, "last byte %02X of Utf8Reader block was incomplete UTF-8", firstbyte); return fallback; } assert(hasMore()); // should never fall out of range if (! Utf8::validFirstByte(firstbyte)) { - LOG(debug, "invalid first byte %02X in Utf8Reader data block", - firstbyte); + LOG(debug, "invalid first byte %02X in Utf8Reader data block", firstbyte); return fallback; } int need = Utf8::numContBytes(firstbyte); @@ -48,8 +46,7 @@ uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback) // check > 0x7F ? return r; } else { - LOG(debug, "invalid continuation byte %02X in Utf8Reader data block", - contbyte); + LOG(debug, "invalid continuation byte %02X in Utf8Reader data block", contbyte); return fallback; } } @@ -69,8 +66,7 @@ uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback) // check > 0x7FF ? return r; } else { - LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block", - contbyte1, contbyte2); + LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block", contbyte1, contbyte2); return fallback; } } @@ -95,11 +91,10 @@ uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback) uint32_t -Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) +Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept { if (! Utf8::validFirstByte(firstbyte)) { - LOG(debug, "invalid first byte %02X in Utf8Reader data block", - firstbyte); + LOG(debug, "invalid first byte %02X in Utf8Reader data block", firstbyte); return fallback; } int need = Utf8::numContBytes(firstbyte); @@ -108,8 +103,7 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) if (need == 1) { if (_p[0] == 0) { - LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", - firstbyte); + LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", firstbyte); return fallback; } unsigned char contbyte = _p[0]; @@ -119,16 +113,14 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) // check > 0x7F ? return r; } else { - LOG(debug, "invalid continuation byte %02X in Utf8Reader data block", - contbyte); + LOG(debug, "invalid continuation byte %02X in Utf8Reader data block", contbyte); return fallback; } } if (need == 2) { if (_p[0] == 0 || _p[1] == 0) { - LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", - firstbyte); + LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", firstbyte); return fallback; } unsigned char contbyte1 = _p[0]; @@ -145,16 +137,14 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) // check > 0x7FF ? return r; } else { - LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block", - contbyte1, contbyte2); + LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block", contbyte1, contbyte2); return fallback; } } assert(need == 3); if (_p[0] == 0 || _p[1] == 0 || _p[2] == 0) { - LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", - firstbyte); + LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", firstbyte); return fallback; } unsigned char contbyte1 = _p[0]; @@ -168,8 +158,7 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) // check > 0xFFFF? return decode4(firstbyte, contbyte1, contbyte2, contbyte3); } else { - LOG(debug, "invalid continuation bytes %02X/%02X/%02X in Utf8Reader data block", - contbyte1, contbyte2, contbyte3); + LOG(debug, "invalid continuation bytes %02X/%02X/%02X in Utf8Reader data block", contbyte1, contbyte2, contbyte3); return fallback; } } @@ -234,7 +223,7 @@ template class Utf8Writer<vespalib::string>; template class Utf8Writer<std::string>; template <typename T> -T Utf8::filter_invalid_sequences(const T& input) +T Utf8::filter_invalid_sequences(const T& input) noexcept { T retval; Utf8Reader reader(input.c_str(), input.size()); diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h index 98e06ca5faf..3367bd5b3d2 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.h +++ b/vespalib/src/vespa/vespalib/text/utf8.h @@ -34,14 +34,14 @@ public: * UTF-8 encoded surrogates are also considered invalid. **/ template <typename T> - static T filter_invalid_sequences(const T& input); + static T filter_invalid_sequences(const T& input) noexcept; /** * check if a byte is valid as the first byte of an UTF-8 character. * @param c the byte to be checked * @return true if a valid UTF-8 character can start with this byte **/ - static bool validFirstByte(unsigned char c) { + static bool validFirstByte(unsigned char c) noexcept { return (c < 0x80 || (c > 0xC1 && c < 0xF5)); } @@ -52,12 +52,12 @@ public: * @param c the first byte (must pass validFirstByte check) * @return 0, 1, 2, or 3 **/ - static int numContBytes(unsigned char c) { + static int numContBytes(unsigned char c) noexcept { if (c < 0x80) return 0; if (c > 0xC1 && c < 0xE0) return 1; if (c > 0xDF && c < 0xF0) return 2; if (c > 0xEF && c < 0xF5) return 3; - throwX("invalid first byte of UTF8 sequence", c); + return -1; } /** @@ -65,7 +65,7 @@ public: * @param c the byte to be checked * @return true if a valid UTF-8 character can contain this byte **/ - static bool validContByte(unsigned char c) { + static bool validContByte(unsigned char c) noexcept { return (c > 0x7F && c < 0xC0); } @@ -82,8 +82,7 @@ public: * @param contbyte second byte in this UTF-8 character * @return decoded UCS-4 codepoint in range [0, 0x7FF] **/ - static uint32_t decode2(unsigned char firstbyte, - unsigned char contbyte) + static uint32_t decode2(unsigned char firstbyte, unsigned char contbyte) noexcept { uint32_t r = (firstbyte & low_5bits_mask); r <<= 6; @@ -108,7 +107,7 @@ public: **/ static uint32_t decode3(unsigned char firstbyte, unsigned char contbyte1, - unsigned char contbyte2) + unsigned char contbyte2) noexcept { uint32_t r = (firstbyte & low_4bits_mask); r <<= 6; @@ -138,7 +137,7 @@ public: static uint32_t decode4(unsigned char firstbyte, unsigned char contbyte1, unsigned char contbyte2, - unsigned char contbyte3) + unsigned char contbyte3) noexcept { uint32_t r = (firstbyte & low_3bits_mask); r <<= 6; @@ -177,14 +176,14 @@ class Utf8Reader private: size_type _pos; - uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback); + uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept; public: /** * Construct a reader for the given block of data * @param input data to read UTF-8 from (can be read-only) **/ - Utf8Reader(stringref input) + Utf8Reader(stringref input) noexcept : stringref(input), _pos(0) {} @@ -193,7 +192,7 @@ public: * @param start pointer to the start of the block * @param sz size of the block in bytes **/ - Utf8Reader(const char *start, size_t sz) + Utf8Reader(const char *start, size_t sz) noexcept : stringref(start, sz), _pos(0) {} @@ -201,7 +200,7 @@ public: * check if the buffer has more data. * @return true if there is more data **/ - bool hasMore() const { return _pos < size(); } + bool hasMore() const noexcept { return _pos < size(); } /** * Decode the UTF-8 character at the current position. @@ -211,7 +210,7 @@ public: * @param fallback the value to return if invalid UTF-8 is found * @return a valid UCS-4 codepoint (or the fallback value) **/ - uint32_t getChar(uint32_t fallback) { + uint32_t getChar(uint32_t fallback) noexcept { unsigned char firstbyte = (*this)[_pos++]; // always steps at least 1 position if (firstbyte < 0x80) { return firstbyte; @@ -232,13 +231,13 @@ public: * * @return a valid UCS-4 codepoint **/ - uint32_t getChar() { return getChar(Utf8::REPLACEMENT_CHAR); } + uint32_t getChar() noexcept { return getChar(Utf8::REPLACEMENT_CHAR); } /** * obtain the current byte offset position * @return position in bytes **/ - size_type getPos() const { return _pos; } + size_type getPos() const noexcept { return _pos; } }; @@ -252,7 +251,7 @@ class Utf8ReaderForZTS { private: const char * &_p; - uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback); + uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept; public: /** @@ -265,7 +264,7 @@ public: * * @param start pointer to the start of the block **/ - Utf8ReaderForZTS(const char * &start) + Utf8ReaderForZTS(const char * &start) noexcept : _p(start) {} @@ -273,7 +272,7 @@ public: * check if the buffer has more data. * @return true if there is more data **/ - bool hasMore() const { + bool hasMore() const noexcept { return (*_p) != '\0'; } @@ -285,9 +284,9 @@ public: * @param fallback the value to return if invalid UTF-8 is found * @return a valid UCS-4 codepoint (or the fallback value) **/ - uint32_t getChar(uint32_t fallback) { + uint32_t getChar(uint32_t fallback) noexcept { unsigned char firstbyte = *_p++; // always steps at least 1 position - if (firstbyte < 0x80) { + if (firstbyte < 0x80) [[likely]] { return firstbyte; } else { return getComplexChar(firstbyte, fallback); @@ -306,7 +305,7 @@ public: * * @return a valid UCS-4 codepoint **/ - uint32_t getChar() { return getChar(Utf8::REPLACEMENT_CHAR); } + uint32_t getChar() noexcept{ return getChar(Utf8::REPLACEMENT_CHAR); } /** * count the number of UCS-4 characters will be returned when @@ -314,7 +313,7 @@ public: * "strlen" does not count the zero termination, but bytes * that aren't valid UTF-8 will count as one character each. **/ - static size_t countChars(const char *p) { + static size_t countChars(const char *p) noexcept { Utf8ReaderForZTS reader(p); size_t i; for (i = 0; reader.hasMore(); ++i) { @@ -340,7 +339,7 @@ public: * that the writer will append to. Must be writable * and must be kept alive while the writer is active. **/ - Utf8Writer(Target &target) : _target(target) {} + Utf8Writer(Target &target) noexcept : _target(target) {} /** * append the given character to the target string. diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp index 204d80340aa..2ba3bc252ae 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.cpp +++ b/vespalib/src/vespa/vespalib/util/alloc.cpp @@ -292,7 +292,7 @@ HeapAllocator::alloc(size_t sz) const { PtrAndSize HeapAllocator::salloc(size_t sz) { if (sz == 0) { - return PtrAndSize(nullptr, sz); + return PtrAndSize(); } void * ptr = malloc(sz); if (ptr == nullptr) { @@ -311,7 +311,7 @@ void HeapAllocator::sfree(PtrAndSize alloc) noexcept { PtrAndSize AlignedHeapAllocator::alloc(size_t sz) const { - if (!sz) { return PtrAndSize(nullptr, 0); } + if (!sz) { return PtrAndSize(); } void* ptr; int result = posix_memalign(&ptr, _alignment, sz); if (result != 0) { diff --git a/vespalib/src/vespa/vespalib/util/alloc.h b/vespalib/src/vespa/vespalib/util/alloc.h index a27bcca0b47..dca4d633b43 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.h +++ b/vespalib/src/vespa/vespalib/util/alloc.h @@ -49,7 +49,7 @@ public: } return *this; } - Alloc() noexcept : _alloc(nullptr, 0), _allocator(nullptr) { } + Alloc() noexcept : _alloc(), _allocator(nullptr) { } ~Alloc() noexcept { reset(); } @@ -83,10 +83,9 @@ private: Alloc(const MemoryAllocator * allocator, size_t sz) noexcept : _alloc(allocator->alloc(sz)), _allocator(allocator) - { - } + { } Alloc(const MemoryAllocator * allocator) noexcept - : _alloc(nullptr, 0), + : _alloc(), _allocator(allocator) { } void clear() noexcept { diff --git a/vespalib/src/vespa/vespalib/util/growstrategy.h b/vespalib/src/vespa/vespalib/util/growstrategy.h index 02e18e44925..643e3f03023 100644 --- a/vespalib/src/vespa/vespalib/util/growstrategy.h +++ b/vespalib/src/vespa/vespalib/util/growstrategy.h @@ -4,14 +4,15 @@ #include <algorithm> #include <cstddef> +#include <cstdint> namespace vespalib { class GrowStrategy { private: - size_t _initialCapacity; - size_t _minimumCapacity; - size_t _growDelta; + uint32_t _initialCapacity; + uint32_t _minimumCapacity; + uint32_t _growDelta; float _growFactor; public: GrowStrategy() noexcept @@ -33,7 +34,7 @@ public: void setInitialCapacity(size_t v) noexcept { _initialCapacity = v; } void setGrowDelta(size_t v) noexcept { _growDelta = v; } - size_t calc_new_size(size_t base_size) const { + size_t calc_new_size(size_t base_size) const noexcept { size_t delta = (base_size * getGrowFactor()) + getGrowDelta(); size_t new_size = base_size + std::max(delta, static_cast<size_t>(1)); return std::max(new_size, getMinimumCapacity()); diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp index 9ed4806385d..2c0d0f4339d 100644 --- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp +++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp @@ -46,7 +46,7 @@ PtrAndSize MmapFileAllocator::alloc(size_t sz) const { if (sz == 0) { - return PtrAndSize(nullptr, 0); // empty allocation + return PtrAndSize(); // empty allocation } sz = round_up_to_page_size(sz); uint64_t offset = alloc_area(sz); diff --git a/vespalib/src/vespa/vespalib/util/small_vector.h b/vespalib/src/vespa/vespalib/util/small_vector.h index b47cb5903b9..ba166362d33 100644 --- a/vespalib/src/vespa/vespalib/util/small_vector.h +++ b/vespalib/src/vespa/vespalib/util/small_vector.h @@ -216,7 +216,7 @@ public: template <typename T, size_t N, size_t M> bool operator==(const SmallVector<T,N> &a, - const SmallVector<T,M> &b) + const SmallVector<T,M> &b) noexcept { if (a.size() != b.size()) { return false; |