Files
mruby-mruby/mrbgems
Yukihiro "Matz" Matsumoto a82911b35f mruby-set: replace khash dependency with embedded kset implementation
Replace the external khash dependency with a custom, memory-optimized
kset implementation that embeds directly into struct RSet. This change
significantly reduces memory consumption and eliminates the need for
khash.h inclusion.

Implemented by: Rovo Dev

Key improvements:
- Embedded kset_t directly in struct RSet (exactly 3 pointers in size)
- Combined memory layout: [keys...][flags...] in single allocation
- Eliminated pointer indirection for better cache performance
- Removed dependency on khash.h and related types (khint_t, khiter_t)
- Maintained full API compatibility with existing mruby-set interface
- Optimized for mrb_value keys with custom hash and equality functions

Technical details:
- kset_t structure: void *data, uint32_t n_buckets, uint32_t size
- Open addressing with linear probing for collision resolution
- 2-bit flags per bucket (empty/deleted) packed efficiently
- Power-of-2 bucket sizing with 75% load factor upper bound
- Integrated GC marking and memory management

Memory savings:
- Eliminates separate khash_t allocation and pointer storage
- Reduces struct RSet from 4 pointers to 3 pointers + embedded data
- More efficient memory layout with better locality of reference

All existing functionality preserved including set operations, iteration,
comparison methods, and Ruby-level API compatibility.
2025-06-25 10:53:42 +09:00
..
2025-06-08 17:00:07 +09:00
2025-06-08 17:04:05 +09:00
2025-06-09 17:14:02 +09:00
2025-06-09 17:13:20 +09:00
2025-06-11 18:31:52 +09:00
2025-06-08 17:02:55 +09:00
2025-06-16 12:45:18 +09:00
2025-06-14 01:02:52 +09:00
2024-09-24 00:14:24 +10:00