awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
andywer avatar

andywer/threads.js

0
View on GitHub↗
3,526 星标·170 分支·TypeScript·mit·7 次浏览threads.js.org↗

Threads.js

threads.js is a JavaScript worker thread library and asynchronous task orchestrator designed to offload CPU-intensive tasks to background threads. It functions as a cross-platform worker pool and a TypeScript worker runner that automatically transpiles and executes TypeScript files within separate threads.

The project distinguishes itself by providing a unified worker API that allows for cross-platform execution across different JavaScript environments. It includes a specialized worker data serialization tool to pass complex class instances and binary data between threads, and supports inlining worker source code as binary blobs.

The library covers a broad range of capabilities including thread pool management, concurrency control, and task cancellation. It also provides mechanisms for binary data transfer via memory buffers, worker error propagation with stack traces, and code sandboxing for isolating security-critical logic.

Features

  • JavaScript Multi-Threading - Implements an execution model that enables multi-threaded operation for JavaScript engines to bypass the event loop.
  • Node.js Worker Thread Pools - Maintains a queue of tasks and a fixed set of workers to balance CPU load and resource consumption.
  • Complex Data Serialization - Supports registering custom serializers to pass class instances and non-cloneable data types between threads.
  • Blocking Task Offloaders - Executes CPU intensive tasks in background threads to prevent blocking the main thread.
  • TypeScript Transpilers - Automatically compiles TypeScript source files into JavaScript at runtime before spawning worker threads.
  • Cross-Platform Worker APIs - Provides a unified worker API that allows for cross-platform execution across different JavaScript environments.
  • Thread Pools - Manages a controlled group of worker threads to distribute bulk tasks and prevent system resource exhaustion.
  • General Purpose - Organizes bulk task executions using thread pools to optimize resource usage and increase overall throughput.
  • TypeScript Execution - Enables running TypeScript files in worker threads by automatically transpiling the code during execution.
  • Background Thread Integration - Executes TypeScript logic in worker threads with automatic transpilation and seamless promise-based communication.
  • Asynchronous Worker Functions - Allows defining functions within worker threads to handle asynchronous calls originating from the main execution thread.
  • Message-to-Promise Proxies - Wraps worker postMessage calls in promises to allow asynchronous function calls between the main thread and workers.
  • Asynchronous Task Orchestrators - Functions as a system for queuing and managing asynchronous jobs with support for task cancellation and concurrency control.
  • Background Thread Dispatchers - Runs functions in separate threads and proxies the return values back to the main thread to maintain responsiveness.
  • Concurrent Task Limiters - Limits the number of concurrent worker threads to prevent system resource exhaustion during CPU-intensive tasks.
  • Unified Worker APIs - Provides a consistent interface for spawning and communicating with workers across multiple JavaScript environments.
  • Complex Object Serializers - Translates complex class instances into cloneable formats to bypass the limitations of the structured clone algorithm.
  • Pending Task Cancellations - Provides the ability to remove pending tasks from the execution queue before they are picked up by a worker thread.
  • Worker Lifecycle Management - Manages the creation and termination of worker threads to optimize resource usage.
  • Distributed Task Workers - Assigns bulk tasks across a controlled group of workers to process high-volume workloads in a predictable manner.
  • Worker Source Inlining - Converts worker source code into binary blob URLs to execute background logic without requiring separate physical files.
  • Inter-Thread Data Transfers - Moves ownership of ArrayBuffers between threads to avoid expensive data copying for large binary datasets.
  • JavaScript Runtime Compatibility Layers - Provides a consistent interface to wrap platform-specific worker implementations for compatibility across different JavaScript environments.
  • JavaScript Runtime Portability - Allows running worker thread logic across different JavaScript environments without modifying the source code.
  • Worker Thread Runners - Automatically transpiles and executes TypeScript files within separate worker threads.
  • Worker Process Error Reporting - Forwards errors from a worker thread to the main thread's promise chain including the original stack trace.
  • Observable Streams - Uses a push-based stream of events to transmit continuous updates from a background thread to the main thread.
  • Task Completion Tracking - Tracks the progress of all queued tasks and resolves only after every job has finished or failed.
  • Reactive Worker Streams - Implements a push-based stream using observables to transmit continuous updates from worker threads to the main thread.
  • Web Worker Management - Uniform API for worker threads.

Star 历史

andywer/threads.js 的 Star 历史图表andywer/threads.js 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

Threads.js 的开源替代方案

相似的开源项目,按与 Threads.js 的功能重合度排序。
  • googlechromelabs/comlinkGoogleChromeLabs 的头像

    GoogleChromeLabs/comlink

    12,715在 GitHub 上查看↗

    Comlink is a remote procedure call library that transforms message-based communication into asynchronous function calls between the main thread and web workers. It provides a proxy-based interface that allows multiple threads to interact with a single object instance without manual message handling. The project enables the execution of functions across separate browser windows, iframes, and web workers, making external calls behave like local asynchronous operations. It supports the transfer of non-cloneable data through custom serialization handlers and allows for the movement of ownership f

    TypeScript
    在 GitHub 上查看↗12,715
  • bogdanp/dramatiqBogdanp 的头像

    Bogdanp/dramatiq

    5,136在 GitHub 上查看↗

    Dramatiq is a distributed task queue and workload manager used to offload function execution to background workers. It functions as an asynchronous task orchestrator that enables the distribution of computational tasks across a cluster using a pluggable transport layer supporting RabbitMQ and Redis. The framework provides specialized tools for complex task orchestration, including the ability to link background jobs into sequences, pipelines, and barriers. It further manages distributed concurrency through the use of shared mutexes, rate limiters, and exponential backoff retries to prevent re

    Pythondistributed-lockpythonrabbit
    在 GitHub 上查看↗5,136
  • developit/greenletdevelopit 的头像

    developit/greenlet

    4,689在 GitHub 上查看↗

    Greenlet is a multi-threaded asynchronous executor and web worker task runner. It serves as an execution wrapper that offloads heavy computation to background workers to maintain user interface responsiveness and prevent the main execution thread from blocking. The project includes a transferable object handler designed to move large data buffers between threads. This mechanism avoids the overhead of memory copying to optimize data transfer. The library covers the management of web workers, facilitating asynchronous task isolation and main thread offloading.

    JavaScript
    在 GitHub 上查看↗4,689
  • ruby-concurrency/concurrent-rubyruby-concurrency 的头像

    ruby-concurrency/concurrent-ruby

    5,830在 GitHub 上查看↗

    Concurrent Ruby is a comprehensive concurrency toolkit for the Ruby language that provides thread-safe data structures, synchronization primitives, and asynchronous execution patterns. It implements core concurrency abstractions including an actor model framework where isolated actors communicate through asynchronous message passing, a future and promise system for composing non-blocking operations, and thread pool executors that manage reusable worker threads for concurrent task execution. The library distinguishes itself through a broad set of coordination mechanisms that go beyond basic th

    Ruby
    在 GitHub 上查看↗5,830
查看 Threads.js 的所有 30 个替代方案→

常见问题解答

andywer/threads.js 是做什么的?

threads.js is a JavaScript worker thread library and asynchronous task orchestrator designed to offload CPU-intensive tasks to background threads. It functions as a cross-platform worker pool and a TypeScript worker runner that automatically transpiles and executes TypeScript files within separate threads.

andywer/threads.js 的主要功能有哪些?

andywer/threads.js 的主要功能包括:JavaScript Multi-Threading, Node.js Worker Thread Pools, Complex Data Serialization, Blocking Task Offloaders, TypeScript Transpilers, Cross-Platform Worker APIs, Thread Pools, General Purpose。

andywer/threads.js 有哪些开源替代品?

andywer/threads.js 的开源替代品包括: googlechromelabs/comlink — Comlink is a remote procedure call library that transforms message-based communication into asynchronous function… bogdanp/dramatiq — Dramatiq is a distributed task queue and workload manager used to offload function execution to background workers. It… developit/greenlet — Greenlet is a multi-threaded asynchronous executor and web worker task runner. It serves as an execution wrapper that… ruby-concurrency/concurrent-ruby — Concurrent Ruby is a comprehensive concurrency toolkit for the Ruby language that provides thread-safe data… typestrong/ts-node — ts-node is a TypeScript execution engine and just-in-time transpiler for Node.js. It enables the direct execution of… caolan/async — Async is a JavaScript asynchronous flow library designed to manage the execution and coordination of asynchronous…