S
S
SergBen2019-08-22 11:19:37
Windows
SergBen, 2019-08-22 11:19:37

Is it possible to direct all resources to one nodejs windows 10 process?

There is a script for node. Iterates over the array, compares, etc.
By CPU load 14%
Is it possible to somehow give it more resources to work faster?
I put all the kernels and real-time mode in the task manager, but nothing has changed.
the code

for (var i = 0, len = squareGrid.features.length; i < len; i++) {
      console.log(i);
      for (var p = 0, len = pins.length; p < len; p++) {
        const point = turf.point([pins[p].lon, pins[p].lat])
        if (turf.booleanPointInPolygon(point, squareGrid.features[i])) {
          if (squareGrid.features[i].properties.hasOwnProperty('count')) {
            squareGrid.features[i].properties.count++
          } else {
            squareGrid.features[i].properties.count = 0;
          }
        }
      }
     
    }

basic calculations here turf.booleanPointInPolygon()
How can this be rewritten?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Radjah, 2019-08-22
@Radjah

Rewrite so that it works in several threads, for example.

R
RidgeA, 2019-08-22
@RidgeA

Split the array into N parts, run N workers, each of which is given a piece of the array, then collect the results
N - this is the number of cores

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question