Closed tom-leys closed 1 week ago
Print merging merges non-string constants only on aggressive
optimization level. The default optimization level is basic
in the web app and aggressive
in the command-line compiler.
Adding #set optimization = aggressive
at the beginning of your program does the trick for the web application.
(Note: I'm not very happy with the way the optimization levels are implemented right now - it seems it generates a lot of confusion. I think it needs some overhaul, but I don't have a clear idea for a better solution at the moment.)
(Note: I'm not very happy with the way the optimization levels are implemented right now - it seems it generates a lot of confusion. I think it needs some overhaul, but I don't have a clear idea for a better solution at the moment.)
How about the compiler output contains hints
Hint: 10 optimiszations did not run, add #set optimization = aggressive
to run them. Alternatively turn on optimizations x,y,z by adding #turn on one optimization
Also, I didn't install the command line compiler because you make it sound quite hard - Java, a database, docker ...
If you had a package with a compiled command line compiler and clear instructions on how to get a JVM (link to a suitable open one) that would have been more attractive and would have reduced your server load.
Also a watch command (though you'd probably need to output to a file in that case) would be useful. Watch, compile, show errors and a keybind that copies the last compile output to the clipboard might work.
How about the compiler output contains hints
Hint: 10 optimiszations did not run, add
#set optimization = aggressive
to run them. Alternatively turn on optimizations x,y,z by adding#turn on one optimization
That would be nice. On the other hand, it is not always easy to figure out whether the aggressive optimization would actually be effective, so the code would become more complex and harder to maintain.
I'll probably add optimization level selection to the web app, plus a generic hint that aggressive optimization might produce better code when run on basic. That'll hopefully draw enough attention to it.
If you had a package with a compiled command line compiler and clear instructions on how to get a JVM (link to a suitable open one) that would have been more attractive and would have reduced your server load.
Yeah, I should do that. Good idea!
Also a watch command (though you'd probably need to output to a file in that case) would be useful. Watch, compile, show errors and a keybind that copies the last compile output to the clipboard might work.
Currently the compiler has a switch that copies the resulting code to the clipboard when the compilation is successful.
Watch does sound like a better alternative, but I don't know Linux that well. If you wished to provide some supporting tools or scripts, I'll gladly include them, but I won't be able to support them.
@tom-leys I've just published a new release, which includes compiled command line tool and installation instructions in the readme. I'd be glad to hear any feedback you might have :)
Wonderful!
I'm currently taking a break from writing mindcode, preparing to start a new contract shortly so studying Go instead to add it to my very long list of known languages. I'll let you know once I've tried it out (but it might be a month or more). In the meantime I hope other authors benefit from your efforts.
I really appreciate your rapid support.
Just to add, I reviewed your documentation and that sounds ideal. Assuming it works as described that is perfect.
Thanks and good luck with your new contract! :)
Thanks @cardillan :)
All the ideas from this thread have been implemented in 2.3.0.
When the compiler (or previous optimization steps in this case) outputs this MLOG
The optimizer should condense it to
This was the result of unrolling a loop which calls a function (now with a constant) and printfs in that function.
The full example is here #136