1

When I try to execute this sketch that is based on a face recognition algorithm it really lags on raspberry, whereas when run on different devices (macbook pro and notebook), it runs smoothly. You can test it using chrome or chromium as a browser.

I am not sure what is the best way to optimise this code so It can run faster. I use it with a local node server directly on the pi. I ran a profiler on chrome with it, and clmtrck.js script seems to be the main bottleneck. I would like to run it around 25/30fps.

I am wondering if any of you have experience optimising code for raspberry and if this kind of hardware acceleration might be an option. Or if there is any cheap method to "boost" a raspberry.

Any pointer is welcome. Thanks!

1 Answers1

1

There are many things that can be done to achieve a performance improvement on a Raspberry Pi. You linked an example using the GPU to achieve better processing speeds. Here is another example that you might want to look at, but it is not a simple solution.

There are many other ways to optimize code, but I am not familiar enough with JavaScript to make a suggestion related to it. However, in general, I'd start by looking at the following things to see if you can apply them to your code:

  • loop unrolling
  • cache optimizations
  • translating some of your code to C

Here are some other links I've found regarding optimizing JavaScript code:

Depending on how much you need to improve your processing speeds, a simple solution would be to overclock your Raspberry Pi.

David
  • 723
  • 5
  • 22