Skip to content

Commit a6bb5e9

Browse files
nicola-cabfinnschiermerjedelbo
authored
RCORE-2094 Compressing Integer Arrays (#7668)
* Add integer compressor for arrays that have type WTypBits * Add packed handler * Add flex handler * Embed integer compression logic inside commit machinery * Tests * Optimization for integer array decompression and Array::find for compressed formats * code review --------- Co-authored-by: Finn Schiermer Andersen <[email protected]> Co-authored-by: Jørgen Edelbo <[email protected]>
1 parent 04acff8 commit a6bb5e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4474
-938
lines changed

Package.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ let notSyncServerSources: [String] = [
5252
"realm/array_blobs_small.cpp",
5353
"realm/array_decimal128.cpp",
5454
"realm/array_fixed_bytes.cpp",
55+
"realm/array_aggregate_optimizations.cpp",
5556
"realm/array_integer.cpp",
5657
"realm/array_key.cpp",
5758
"realm/array_mixed.cpp",
@@ -78,6 +79,9 @@ let notSyncServerSources: [String] = [
7879
"realm/group.cpp",
7980
"realm/group_writer.cpp",
8081
"realm/history.cpp",
82+
"realm/integer_compressor.cpp",
83+
"realm/integer_flex_compressor.cpp",
84+
"realm/integer_packed_compressor.cpp",
8185
"realm/impl",
8286
"realm/index_string.cpp",
8387
"realm/link_translator.cpp",

evergreen/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ functions:
137137
set_cmake_var realm_vars REALM_LLVM_COVERAGE BOOL On
138138
fi
139139
140+
if [[ -n "${compress|}" ]]; then
141+
set_cmake_var realm_vars REALM_COMPRESS PATH "${cmake_toolchain_file}"
142+
fi
143+
140144
set_cmake_var realm_vars REALM_BUILD_COMMANDLINE_TOOLS BOOL "${build_command_line_tools|On}"
141145
set_cmake_var realm_vars REALM_ENABLE_ENCRYPTION BOOL "${enable_realm_encryption|On}"
142146
if [[ -n "${compress|}" ]]; then

src/realm/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set(REALM_SOURCES
1313
array_blobs_big.cpp
1414
array_decimal128.cpp
1515
array_fixed_bytes.cpp
16+
array_aggregate_optimizations.cpp
1617
array_integer.cpp
1718
array_key.cpp
1819
array_mixed.cpp
@@ -36,6 +37,9 @@ set(REALM_SOURCES
3637
db.cpp
3738
group_writer.cpp
3839
history.cpp
40+
integer_compressor.cpp
41+
integer_flex_compressor.cpp
42+
integer_packed_compressor.cpp
3943
impl/copy_replication.cpp
4044
impl/output_stream.cpp
4145
impl/simulated_failure.cpp
@@ -163,6 +167,9 @@ set(REALM_INSTALL_HEADERS
163167
handover_defs.hpp
164168
history.hpp
165169
index_string.hpp
170+
integer_compressor.hpp
171+
integer_flex_compressor.hpp
172+
integer_packed_compressor.hpp
166173
keys.hpp
167174
list.hpp
168175
mixed.hpp

src/realm/alloc_slab.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ SlabAlloc::FreeBlock* SlabAlloc::allocate_block(int size)
388388
if (remaining)
389389
push_freelist_entry(remaining);
390390
REALM_ASSERT_EX(size_from_block(block) >= size, size_from_block(block), size, get_file_path_for_assertions());
391+
const auto block_before = bb_before(block);
392+
REALM_ASSERT_DEBUG(block_before && block_before->block_after_size >= size);
393+
const auto after_block_size = size_from_block(block);
394+
REALM_ASSERT_DEBUG(after_block_size >= size);
391395
return block;
392396
}
393397

0 commit comments

Comments
 (0)