Page 1 of 1

What has the most impact on the size of a template?

Posted: 26 Nov 2013 13:10
by electrofux
I am constantly fighting the size restriction of my template. So i am wondering where i can save the most.

Is the size simply depending on the size of the jzml file and thus from the number of lines/characters in it. Or do certain object use up alot more than others. If so what objects are heavy and which ones are lighter. I assume using a 1x16 switch uses less than 16 custom buttons.
How about containers, do they make thing alot bigger. Is a new interface lighter than a new container?

I have already saved some space through reusing objects through dynamic scripting so i think object use up more than even bigger scripts, right?

Re: What has the most impact on the size of a template?

Posted: 27 Nov 2013 10:10
by Softcore
I have a lot and more complex questions about these things myself too as Im not a proffesional programmer and I really dont know but the absolute basics when it comes to code optimising.

For example, does it even make a difference if in a script I have "x = y/2" or "x=y*0.5"
Is it better to use a static predefined vector or a create one in a script dynamically?
Is it better to fill a vector with values statically or to use a function?

And aaaaaaaaaaaaallllll sorts of other questions....
Well actually my questions are related more to performance and not the template size, but still, when reaching the limits of size, optimised code can really make a difference too, I think.
I also think a well informed Lemur scripter should take the bite and post some general rules of practises for such things.

EDIT to add: as for multi-objects, I've read elsewhere and you are correct: its better to use a multi-object instead of single iterations of the same object when that is possible (pads, switches etc)

Re: What has the most impact on the size of a template?

Posted: 27 Nov 2013 22:00
by Macciza
Hi
Can't answer all of those questions right now off the top of my head but can offer a suggestion or two . .
Different objects take up more space then others - someone posted some general guides a while ago - scripts in general I believe take up less space, but then objects have 'hidden' scripts in them that do there stuff . .

Starting from a blank project chuck a 4*4 Pads on then hover over the Size indicator and it should show a numeric value for 'Bytes used' - this shows ~23k
Then delete it and add 1 single Pads object and check (~22k) then make it 16 individual Pads (~320k)
One could also look to see how scripts affect these figures ….

Will have to have a think on some of the others but I think that anything that can be defined as a constant is probably best done that way

Re: What has the most impact on the size of a template?

Posted: 28 Nov 2013 16:07
by midimockup
2 things I've noticed:
1) lots of text objects
2) scripts involving bidirectional MIDI (i.e. MIDI_ARGS). Not sure if limiting the number of channels the script listens to has an effect.

Re: What has the most impact on the size of a template?

Posted: 04 Dec 2013 18:48
by Traxus
Awhile ago, I wrote a php script that would minify and obfuscate one of my lemur templates. Basically, variable names, function names etc would get shortened so that 'longVariableName' would become var001, 'longFunctionName' would become func001 etc... It also removed unnecessary white space as a .jzml is just a fancy xml file. Surprisingly, the effect was minimal, file size dropped from 2,329 to 2,039 KiB... Hinting that the lemur editor probably does some compiling on its own?

In essence, I tend to agree that it is largely based on object count.