Offload functions to worker threads with shared memory primitives for Node.js.
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 53a9d018f66d1e2d08e62cd2bc0cf4845c291e75 10 lines 301 B view raw
1import { mo } from '../../src/index.ts'; 2 3export const fibonacci = mo(import.meta, (n: number): number => { 4 // Deliberately naive recursive fibonacci — CPU-heavy but bounded 5 function fib(x: number): number { 6 if (x <= 1) return x; 7 return fib(x - 1) + fib(x - 2); 8 } 9 return fib(n); 10});