gems karafka-core 2.5.11
v2.5.11

4 hours ago
  • [Enhancement] Specialize Contract#dig for common 1-key and 2-key paths to avoid iterator overhead, yielding ~1.5x faster single-key lookups and ~1.45x faster two-key nested lookups.
  • [Enhancement] Replace Node#build_accessors @local_defs Array with Hash for O(1) membership checks instead of O(n) Array#include?, yielding up to ~5x faster accessor lookups at 50 settings.
  • [Enhancement] Use frozen EMPTY_ARRAY constant for Contract#call and #validate! default scope parameter to avoid allocating a new Array on every invocation, yielding ~1.36x faster call dispatch and saving 1 Array allocation per call.
  • [Enhancement] Pre-resolve @events_methods_map method name before the listener notification loop in Notifications#instrument to avoid repeated Hash lookup per listener, yielding ~1.12x faster event dispatch with multiple listeners.
  • [Enhancement] Cache a frozen success Result singleton via Result.success to eliminate 1 object allocation per successful Contract#call on the happy path.
  • [Enhancement] Skip nestings block re-evaluation in Node#deep_dup to avoid recreating children that are immediately overwritten, yielding ~14x faster deep_dup and reducing allocations from ~620 to ~66 objects for large configs.
  • [Enhancement] Cache CallbacksManager#call values snapshot and invalidate on add/delete to avoid allocating a new Array on every invocation while preserving thread-safety snapshot semantics, saving 1 Array allocation per call.
  • [Enhancement] Store execution time separately in Event and build the merged payload hash lazily on #payload access, eliminating 1 Hash allocation per Notifications#instrument call when listeners use #[] access (the common pattern), yielding ~1.7x faster event dispatch.
  • [Enhancement] Replace StatisticsDecorator#diff pending-writes buffer with keys.each direct-write iteration, eliminating the buffer and write-back loop for ~13% faster decoration at scale (10 brokers, 20 topics, 2000 partitions).
  • [Enhancement] Reorder StatisticsDecorator#diff type checks to test Numeric before Hash, matching the ~80% numeric value distribution in librdkafka statistics.
  • [Enhancement] Support only_keys option in StatisticsDecorator to decorate only specified numeric keys (e.g. consumer_lag, committed_offset). When combined with excluded_keys, reduces decoration cost from ~80ms to ~8.5ms per call on large clusters (10 brokers, 20 topics, 2000 partitions) by using structure-aware navigation of the librdkafka statistics tree and direct key access instead of full-hash iteration.

Don't miss a new karafka-core release

NewReleases is sending notifications on new releases.