Open ewmailing opened 3 years ago
I have prepared a stripped down version of my program that reproduces this problem. I place these files in pallene/experiments/stocks3 stringperf.tar.gz
Thanks! Could you plase clarify how long it takes to run the Lua and Pallene versions of this benchmark? I'm confused if this is the one where Pallene took 0.3 seconds or 1.2 seconds or if it is yet another number.
Another thing that I wonder is if there is a way to build a smaller example. Does this behavior only appear in large Pallene files?
No, the timings are different for these files. This is actually a stripped down version of my program. I originally tried to do a much simpler program from scratch, but it did not reproduce the behavior. So I had to go back to my original program and start ripping things out. This all took me a lot of time to do, but I feel the program submitted here is a reasonable compromise. I don't think it as bad as it seems. I believe the performance bottleneck is contained to the function GenerateBackTestPlotForChartJS
. This is the function with all the .. operations. All the other stuff is just filling stub data so this function can do work. And this function also has another fake-out in that there is a very long string constant of Javascript code that makes the function look scarier than it is. It is just a string constant you can skim past down to find the real body of code being run. (Interesting tidbit, the string constant is so long, it triggers a C compiler warning for ISO C89/C90 mode.)
So the timings for these attached files on my computer are as follows:
Pallene: (made sure .lua was deleted)
$ ./pallenec -O2 experiments/stocks3/stringperf.pln
$ time ./vm/src/lua experiments/stocks3/strbug.lua
SavePlot elapsed time: 7.74
real 0m7.904s
user 0m4.576s
sys 0m3.328s
Lua: (made sure .so file was deleted)
$ ./pallenec --emit-lua experiments/stocks3/stringperf.pln
$ time ./vm/src/lua experiments/stocks3/strbug.lua
SavePlot elapsed time: 2.73
real 0m2.733s
user 0m2.216s
sys 0m0.516s
P.S. My test program here adds some extra loops to pad out the run time because my real program had a lot more data.
Discussed in https://github.com/pallene-lang/pallene/discussions/504