Skip to content

feat: faster and more modular#7

Merged
Lojhan merged 7 commits intomainfrom
feat/dynamic_size
Feb 6, 2026
Merged

feat: faster and more modular#7
Lojhan merged 7 commits intomainfrom
feat/dynamic_size

Conversation

@Lojhan
Copy link
Copy Markdown
Owner

@Lojhan Lojhan commented Feb 6, 2026

This pull request introduces significant refactoring and new features to the resource pool implementation, focusing on modularizing pool types, improving the benchmarking suite, and simplifying dependencies. The changes include extracting distinct pool implementations, updating the wrapper API, expanding benchmarks to cover new pool types, and cleaning up the Rust core and dependencies.

Pool Implementation Refactor and API Changes:

  • The GenericObjectPool wrapper in both index.wrapper.cjs and index.wrapper.mjs now delegates to separate pool implementations: StaticObjectPool, DynamicObjectPool, and EnginePool, which are imported from new files under implementations/. The wrapper provides static methods to instantiate each type, making the API clearer and more modular. [1] [2]
  • The package now exports these new implementation files and exposes them in the exports field of package.json, allowing consumers to import specific pool types directly. [1] [2]

Benchmarking Improvements:

  • New benchmark scripts were added for GenericObjectPool in dynamic and engine modes, both for synchronous and .use() (async) usage patterns. This provides broader and more granular performance comparisons. [1] [2] [3] [4]
  • Existing benchmarks were renamed for clarity, distinguishing between "Static", "Dynamic", and "Engine" pool types. [1] [2]
  • The benchmark results table was updated to include results for all new pool types and usage modes, providing a more comprehensive overview of performance.

Rust Core and Dependency Cleanup:

  • The Rust implementation was simplified by removing unused dependencies (crossbeam-queue, once_cell) and switching to parking_lot::Mutex for synchronization. [1] [2]
  • The GenericObjectPool Rust struct now uses a simplified CorePool and improves error handling, especially for closed pools, and uses a more appropriate shutdown method (close instead of drain). [1] [2] [3] [4] [5]

Most Important Changes

1. Pool Implementation and API Refactor

  • Extracted StaticObjectPool, DynamicObjectPool, and EnginePool implementations, and updated the main wrapper (GenericObjectPool) to delegate instantiation and usage to these classes, improving modularity and clarity of the API. [1] [2]
  • Updated package.json to export new implementation files and allow direct imports of specific pool types. [1] [2]

2. Benchmark Suite Expansion

  • Added new benchmark scripts for dynamic and engine pool types, both for synchronous and .use() async usage patterns, and renamed existing benchmarks for clarity. [1] [2] [3] [4] [5] [6]
  • Updated benchmark results to reflect new pool types and provide a comprehensive performance comparison.

3. Rust Core Simplification

  • Removed unused dependencies (crossbeam-queue, once_cell) and switched to parking_lot::Mutex for synchronization in the Rust core. [1] [2]
  • Improved error handling and shutdown logic in the Rust GenericObjectPool implementation. [1] [2] [3] [4] [5]

@Lojhan Lojhan merged commit 74fca89 into main Feb 6, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant