This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| #include <regex> | |
| #include <vector> | |
| #include <chrono> | |
| #include <utility> // For std::pair | |
| int main() { | |
| // Generate approximately 10 MB of in-memory text data | |
| const size_t target_size = 10 * 1024 * 1024; // 10 MB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <unordered_map> | |
| #include <random> | |
| #include <chrono> | |
| #include <cstdint> | |
| #include <limits> | |
| #include <cstring> | |
| #include <cstdlib> | |
| #include <cstdio> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdint> | |
| #include <cstring> | |
| #include <cstdio> | |
| #include <random> | |
| #include <limits> | |
| #include <algorithm> | |
| #include <array> | |
| #include <vector> | |
| #include <cmath> | |
| #include <map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdint> | |
| #include <cstring> | |
| #include <cstdio> | |
| #include <random> | |
| #include <limits> | |
| #include <algorithm> | |
| #include <array> | |
| #include <vector> | |
| #include <cmath> | |
| #include <map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct ConstexprBitset64 { | |
| uint64_t block = 0; | |
| constexpr void set(size_t idx) { | |
| block |= uint64_t{1} << idx; | |
| } | |
| constexpr void clear(size_t idx) { | |
| block &= ~(uint64_t{1} << idx); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.14) | |
| project(kvstore_python LANGUAGES CXX) | |
| # ---------------------------- | |
| # 1) Find Python | |
| # ---------------------------- | |
| find_package(Python COMPONENTS Interpreter Development REQUIRED) | |
| message(STATUS "Python executable: ${Python_EXECUTABLE}") | |
| message(STATUS "Python include dirs: ${Python_INCLUDE_DIRS}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <string> | |
| #include <random> | |
| #include <unordered_map> | |
| #include <arm_neon.h> // Specialized for your M2 chip | |
| // 1024-bit vector = 128 bytes = 2 Cache Lines | |
| // We use alignas(64) to ensure the CPU doesn't cross cache line boundaries | |
| struct alignas(64) HyperVector { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static inline bool insertToSpecPage(uint32_t* page, uint32_t hash, const size_t mask) { | |
| size_t spot_i = hash & mask; | |
| for (int i = 0; i <= mask; ++i) | |
| { | |
| if (page[i] == 0) { | |
| page[i] = hash; | |
| return true; | |
| } | |
| spot_i = (spot_i + 1) & mask; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum class HashQueryRes { | |
| Empty, | |
| Occupied, | |
| Found | |
| }; | |
| class HashOnlyLinearMap { | |
| struct KVPair { | |
| uint32_t _hash = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <unordered_map> | |
| #include <random> | |
| #include <chrono> | |
| #include <cstdint> | |
| #include <limits> | |
| #include <cstring> | |
| #include <cstdlib> | |
| #include <filesystem> |
NewerOlder