Ways to improve your FPS:
-Short circuit your boolean expressions:
if (x && y) {} //if x is false, then y won't even be evaluated
-Remove unused variables and redundant statements
-etc.
These two yield zero increase in performance, variables are just value lookups on the script's virtual stack. Mkm handles these things quite well.
Optimization
can be taught, but you really want to focus on optimization
after you reach a certain level in your project, for example: after finishing a boss battle, stage, or even cleaning up and preparing for a demo. If there's one thing about programming games you should know, you build your game the smart way, and worry about "what can I do make improve performance" later. The last thing you need to do is develop unnecessary lag safety habits early on, danmakufu is not a very performance optimized engine so there is a limit to what you can do to improve and avoid lag.
I suggest being mindful of sprite objects you have going around, deleting unused things is best, textures can stay in memory no problem but sprites, bullets, enemies etc... need to go. Be mindful of the calculations you make, you don't need to have an ellipse formula for a ring of bullets, or some other unnecessary trig ran each frame.
But after all of these things are said and done, at the end of the day, it is all left up to how good your computer is. Don't let worrying about optimization discourage you and take away the fun of making games. I had to learn that the hard way, and most serious programmers will tell you the same. (after I spent nights worrying about improving my personal danmaku engine I made in both C++ and C#, I ended up seeing that those efforts were unnecessary)