In my nodejs code, I am running postMessage every 30ms for arrays as large as 100kb. Most of the time this only takes 1ms, but on some of my projects, it takes up to 50ms.
I’m really confused… I’m running the exact same piece of code, why is it that in several my projects, postMessage takes a much longer time? The CPU and RAM usages are completely fine.
I doubt that it is a problem with my code, I feel that it is a replit server issue. Occassionally the laggy code would fix on it’s own and the runtime for postMessage would magically drop to below 10ms consistently.
I also noticed that along with the increased runtime, latency would sometimes increase too. My replit projects usually have a latency of around 180ms, but sometimes this number would jump to more than 300ms.
Is it a problem with my code or the replit servers? I have attached a screenshot of a part of my code and also the console. (Note that my code console.logs the runtime and then the size of the data sent)