feat(demo, docs): introduce threading test demos for browser and fallback, enhance threading documentation
- Added `test-browser-worker.html` to demonstrate threading with Web Workers in browser environments. - Added `test-fallback.html` to verify fallback functionality when threading is unavailable. - Created `THREADING.md` to document unified threading implementation, including Node.js Worker Threads, Web Workers, and fallback mechanisms. - Updated Node.js version requirement in `README.md` and `package.json` to `>=24.0.0` for compatibility with improved Worker Threads API. - Enhanced `workerUtils.ts` to implement threading with a worker pool for Node.js and added Web Worker execution logic for browsers. - Enabled environment-aware threading availability in `environment.ts`. - Updated `rollup.config.js` to include CLI configurations for streamlined builds. - Adjusted `.gitignore` to exclude test artifacts and package files. These changes provide comprehensive testing and documentation of threading functionality, improve cross-environment compatibility, and enhance developer workflows.
This commit is contained in:
parent
f64589b559
commit
de627c5dfa
10 changed files with 664 additions and 21 deletions
24
README.md
24
README.md
|
|
@ -3,7 +3,7 @@
|
|||
<br/><br/>
|
||||
|
||||
[](LICENSE)
|
||||
[](https://nodejs.org/)
|
||||
[](https://nodejs.org/)
|
||||
[](https://www.typescriptlang.org/)
|
||||
[](CONTRIBUTING.md)
|
||||
[](https://www.npmjs.com/package/@soulcraft/brainy)
|
||||
|
|
@ -1264,7 +1264,27 @@ comprehensive [Scaling Strategy](scalingStrategy.md) document.
|
|||
|
||||
## Requirements
|
||||
|
||||
- Node.js >= 23.11.0
|
||||
- Node.js >= 24.0.0
|
||||
|
||||
### Node.js 24 Optimizations
|
||||
|
||||
Brainy takes advantage of several optimizations available in Node.js 24:
|
||||
|
||||
1. **Improved Worker Threads Performance**: The multithreading system has been completely rewritten to leverage Node.js 24's enhanced Worker Threads API, resulting in better performance for compute-intensive operations like embedding generation and vector similarity calculations.
|
||||
|
||||
2. **Worker Pool Management**: A sophisticated worker pool system reuses worker threads to minimize the overhead of creating and destroying threads, leading to more efficient resource utilization.
|
||||
|
||||
3. **Dynamic Module Imports**: Uses the new `node:` protocol prefix for importing core modules, which provides better performance and more reliable module resolution.
|
||||
|
||||
4. **ES Modules Optimizations**: Takes advantage of Node.js 24's improved ESM implementation for faster module loading and execution.
|
||||
|
||||
5. **Enhanced Error Handling**: Implements more robust error handling patterns available in Node.js 24 for better stability and debugging.
|
||||
|
||||
These optimizations are particularly beneficial for:
|
||||
- Large-scale vector operations
|
||||
- Batch processing of embeddings
|
||||
- Real-time data processing pipelines
|
||||
- High-throughput search operations
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue