In my current side project my code is performing a large amount of very simple computation on large numbers.
- I'm using the library "[email protected]" to handle the large number aspect.
- I'm using the library "[email protected]" & "[email protected]" to bundle the final product
- I'm using "node:worker_threads" to run this code in a separate Thread
To simplify my loop is:
let t = // big number
let b = a // big number
while(t > 0) {
b = b ^ (2^1024) MOD N
t -= 1024
}
To monitor the performance, I've implemented a benchmark function that permits to get the velocity of this loop on my hardware (number of exponentiation per second)
- If I'm running the benchmark on nodeJS I got something around 400 kExp/s
- If I'm running the benchmark in dev with Electron (started with "electron .") I got something around 800 kExp/s
- If I'm running the benchmark in prod with Electron (bundled with electron-builder) I got something around 400 kExp/s
Do you have an idea to explain why Electron is so fast in development mode ? I'm very curious about the reason which can explains such differences.