Open zamazan4ik opened 11 months ago
Yes, that sounds like a good thing to try.
There are benchmarks in the benchmark folder that you could try (I've tended to just use mandelbrot.js
for quick tests). On-device I do:
function m() {
for (y=0;y<32;y++) {
line="";
for (x=0;x<32;x++) {
var Xr=0;
var Xi=0;
var Cr=(4.0*x/32)-2.0;
var Ci=(4.0*y/32)-2.0;
var i=0;
while ((i<8) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
i++;
}
if (i&1)
line += "*";
else
line += " ";
}
// print(line);
}
}
t=getTime();m();print(getTime()-t);
I imagine since we can't easily profile on embedded it might be worth running a 32 bit compile on Raspberry Pi, which should be a marginally closer platform to the Cortex M4.
Perhaps you could create a branch with PGO added using that to show how the process works? If it's providing marked improvements then we could look at coming up with some more representative JS code for profiling.
Any progress on this, or shall I close it?
Any progress on this, or shall I close it?
No progress yet on this from my side. But I do not think that we need to close it. It could stay open, and possibly other future contributors will be interested in starting work on this.
Hi!
Recently I checked Profile-Guided Optimization (PGO) improvements on multiple projects. The results are here.
Since PGO showed measurable improvements in compiler/interpreter-like workloads (V8, CPython, Clang, Clangd, GCC, Rustc, etc.) I think it could be useful to check PGO for the Espruino project too.
We need to perform PGO benchmarks on Espruino. And if it shows improvements - add a note about possible improvements in Espruino performance with PGO. Providing an easier way (e.g. a build option) to build scripts with PGO can be useful for the end-users too.