분류 javascript

자바스크립트로 쉬운 멀티 코어 프로세싱

컨텐츠 정보

  • 조회 164 (작성일 )

본문

https://github.com/parallel-js/parallel.js

 

import { Jobs, ParallelArray } from 'paralleljs';

// Execute multiple jobs in parallel and asynchrnously
const jobs = new Jobs();
const [job1, job2, job3] = await jobs.all([
  () => fibonacci(1),
  gaussianSumm,
  foobar
]);
console.log(job1, job2, job3);

// An array with all methods parallelized
const array = new ParallelArray([1, 2, 3]);
array.push(1);
array.map(e => e + 1);
array.filter(e => !!e);