We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Can anyone recommend a code minimizer (whitespace removal, variable optimization) that works well with processing code ? I am particularly interested to use this for processingjs based web applications.
Answers
Moved from Questions about Code since you don't show any code.
I don't see the point of having a minimizer for .pde files. I mean, most sketches I saw are way below 10 KB, a minimizer will gain almost nothing in terms of loading speed.
Unless you really want a code obfuscator... I never heard of one, so far.
In a first step, you can convert your Processing code to JavaScript using the ProcessingJS helper tool: http://processingjs.org/tools/processing-helper.html
In a second step, you can minimize the obtained JavaScript code with a standard JavaScript compressor such as YUI Compressor: http://yui.github.io/yuicompressor/
I agree, however, with PhiLho that minimizing won't help much with regards to loading speed. It will only help to obfuscate the code partially (but source viewers in browsers are still able to pretty-format the code).
However, according to my experience, load speed can be gained using converted PDE -->JS code (see step 1 above), because the compile step will be omitted when the sketch is started.
Just to see the effect of file sizes of an example of mine:
Step 0: example.pde (9.5 kbyte) and processing-1.4.1-min.js (231.9 kbyte): total 241.4 kbyte. The size of the uncompressed processing-1.4.1.js would be 421.5 kbyte.
Step 1: converted example.pde --> example.js (8.7 kbyte) and processing-1.4.1-api.min.js (195.3 kbyte): 204 kbyte. Saving 15.5% with regards to step 0, the majority contributed by the smaller size of processing-api-min.js compared to processing-min.js.
Step 2: YUI-compressed example.js --> example-min.js (3.0 kbyte) and processing-1.4.1-api.min.js (195.3 kbyte): 198.3 kbyte. Saving 2.8% with regards to step 1, 17.9% with regards to step 0.
So, to conclude with PhiLho: If the size of your code is not several 10-100 KB, it's not worth to compress it except for reason of obfuscating.
Thanks for the comments. I will go for converting to javascript and then maybe minimizing further.