mapbox / mapbox/node-cpp-skel

[FUTURE] Write a comparison benchmark using `worker_threads` module

Aperta
#143 5 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C++
Stelle
74
Fork
9
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

v10.5.0 has a new `worker_threads` module that allows pure JS functions to run on a separate thread. The node-cpp-skel demonstrates doing this type of thing using C++, but the `worker_threads` module allows for it in pure JS. (https://nodejs.org/en/blog/release/v10.5.0/)

It would be useful to try to write an 🍏 to 🍏 (or as close as we can get) comparison benchmark of doing the same work in C++ threads vs JS threads using `worker_threads`. We would try to answer questions like:

- 🍒 Is performance of passing data (#69, #67) similar in with `worker_threads` vs using libuv directly in C++?
- 🍊 When combined (overhead of thread queuing, passing data to the thread, doing compute, getting data back) which approach is faster?

We could get at 🍒 by writing a benchmark that passes the same, large data, and does no compute in the thread. Instead that thread could just sleep for N seconds.

We could get at 🍊 by passing the same data and doing the same (as close as possible) compute, perhaps a Fibonacci (or some kind of classical compute intensive workload).

----

Depending on the results we will want to update https://github.com/mapbox/cpp/blob/master/node-cpp.md#why-create-a-node-addon which says:

> Why create a node addon?
> To port a C++ project to Node to expose a new interface for the tool (like Mapnik & Node Mapnik)
> Improve performance at scale where Node becomes the bottleneck (i.e. concurrency)

If JS is just as fast as C++, then we'll want to update that doc to mention `worker_threads` as a more ideal solution than writing a node addon to access the thread pool. If `JS/worker_threads` is slower than C++ then we'll probably want to add details to that doc about what types of workloads or performance situations we'd want to use C++ and which we'd want to consider `JS/worker_threads`

/cc @mapbox/core-tech

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando gli esempi di node-cpp-skel e la sezione node-cpp.md collegata nell'issue, insieme alle informazioni sulla release di worker_threads a cui si fa riferimento. Definisci benchmark comparabili dei worker in C++ e JavaScript per il passaggio dei dati e il calcolo, quindi usa i risultati per determinare se node-cpp.md necessita di indicazioni aggiornate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, javascript, node.js
Ambito
documentation, performance
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.