mapbox / mapbox/node-cpp-skel

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

Đang mở
#143 5 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C++
Star
74
Fork
9
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xem xét các ví dụ node-cpp-skel và phần node-cpp.md được liên kết trong issue, cùng với thông tin release của worker_threads được tham chiếu. Xác định các benchmark worker tương đương bằng C++ và JavaScript cho việc truyền dữ liệu và tính toán, sau đó sử dụng kết quả của chúng để xác định liệu node-cpp.md có cần cập nhật hướng dẫn hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, javascript, node.js
Lĩnh vực
documentation, performance
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.