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

Re: Where's the Board???



PureBytes Links

Trading Reference Links


>Date: Sun, 25 Oct 1998 09:34:57 -0700
>From: "Gary Fritz" <fritz@xxxxxxxx>
>To: omega-list@xxxxxxxxxx
>Subject: Re: Where's the Board???
>
>Re: Pierre's EL optimizations:
>
>> Lets take the first 3 lines
>> VALUE1 = @MOMENTUM(C,3);
>> VALUE2 = @MOMENTUM(C,3)[1];
>> VALUE3 = .03*(VALUE1-VALUE2)+(1-.03)*VALUE3;
>>   ...
>> Sould be now obvious to anyone that this could reduce to:
>> Value0=c-c[1];
>> Value3= .03*(value0-value0[3])+ (1-.03*)value3; 
>> 
>> (could also replace 1-0.03 by .97)
>
>This is excellent and creative optimization, and will definitely 
>result in faster-running code.
>
>**HOWEVER**:
>
>Unless maximum blinding speed is your key requirement, this may not 
>be the best way to write your code.  Code like this has a tendency to 
>be "write-only" -- nobody (yourself included, if you come back to it 
>2 weeks from now) is going to understand it.  If you want to refer 
>back to the indicator at a later time, maybe to improve it or to 
>incorporate it into other code, you might have a tough time 
>deciphering the optimized code.
>
>IMHO, in many/most cases, clear and understandable code is more 
>important than tweaked-to-the-Nth-degree code.
>
>If you decide that you really do require maximally-optimized code 
>like Pierre derived, then I suggest you do yourself a favor.  Be sure 
>to include the *original* unoptimized code, AND if appropriate the 
>manipulations you performed to optimize it, as a COMMENT in your 
>code.  That way you can come back to the code at a later time and 
>still understand what it's doing.

Gary,

Pierre's purpose was to present EL as a more efficient and suited
Trader language than VB.

It's funny but the programmer (I am) failed to understand how this
rewriting is possibily a real creation, or an optimization of :

	Value0=c-c[3];
	Value3= .03*(value0-value0[1])+ .97*value3; 

Unless I missed the point and optimization does refer to the original
("basic like") code using three lines while EL only requires two ?

I'm sure most of use do remember the good old times when PC BASIC
was an interpreted language on 1000x slower PC's and programmers
were judged based on their capabilities to write the shortest possible
code. I've beaten them all hands down :

	A=c-c[3];B=.03*(A-A[1])+.97*B; 

Nice EL code, but are you convinced ? - Where is the demonstration
that, once compiled, it is certainly faster than a compiled :

	VALUE1 = @MOMENTUM(C,3);
	VALUE2 = @MOMENTUM(C,3)[1];
	VALUE3 = .03*(VALUE1-VALUE2)+(1-.03)*VALUE3;

The truth is not there ! The kind of optimization games doesn't make
any sense for a modern programmer... they should even less for
a trader.
It has been the role of compilers for decades (ie before the PC became
a computer), and it's the purpose of languages like VB that people
can write clear and well documented modules without having to count
bit, bytes, instructions and the like.

PS - I would add that maintaining two versions of the same code is a very
bad programming practice with a brilliant position in the long list of
"don'ts".
Again, would you recommand to a trader a program maintenance complexity
even a (sane) programmer will refuse ?

PPS - Basic's life is just a series of survival battles. It was supposed to
be eaten by C, by Pascal. But nobody will change that VB has become the
preferred language in the SOHO.
Somebody wrote that Equis lost a competitive advantage because the CEO
didn't trust Windows. Story does repeat sometimes, Windows => VB and
Equis => .... 

-- Alain