[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why use Value1, Value2,...



PureBytes Links

Trading Reference Links

> Named variables use up EXE size, and that makes a difference in
> TS4 which has a 64K limit. 

They do make a difference, but it is very small.  And I'm not 
convinced it makes **ANY** difference in EXE size.

I just created an indicator with 50 variables, named X1 through X50.  
Then I added 5 lines of the form X10 = X1 + X2 + ... + X9, X20 = ...

I verified the indicator and looked at the files that were created:
  I0417.ASC    784 bytes
  I0417.TOK  11361 bytes

Then I changed all the "X"s to "Value".
  I0417.ASC    533 bytes
  I0417.TOK  11361 bytes

The ASC file increased by a whopping 251 bytes, for 50 variables.

I don't know how to measure the EXE size, and I didn't go through the 
full exercise of finding an almost-too-big indicator and changing the 
variables, but in compiled code the symbolic names should make no 
difference in size.  The only difference I can imagine is due to the 
initialization value required for named variables -- it's possible 
that EL uses some kind of compact shortcut to initialize all the 
ValueX variables to zero, or something like that.  I suppose it's 
also possible that compiled EL uses a compact code form to access the 
predefined value1 vars, but I'd be surprised if they were that clever.

So if you're right at the EXE limit, it's possible that renaming 
variables **might** drop a few hundred bytes from the EXE size which 
**might** get you below the limit.

On the other hand, I can guarantee you that if you use ValueXX for 
all your variables, your code will be much harder to read, and you 
will be MUCH more prone to nasty-to-debug errors where you mistyped 
Value21 instead of Value12 or whatever.

As for me, I'd rather work on simplifying the system logic or moving 
it out to included systems or something like that, rather than 
turning this large piece of code into a maintenance nightmare.

Gary