Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #4011

Re: Self:Variable vs parameter

From "Wolfgang Riedmann" <wriedmann@gmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Self:Variable vs parameter
Date 2012-08-29 15:21 +0000
Message-ID <aa6qblFabuU1@mid.individual.net> (permalink)
References <DXp%r.303855$Re2.178310@fx06.am4>

Show all headers | View raw


Hi Martin,

> Which is better for performance?
> 
> Using Self:something in a class or sending something as a parameter
> into each method?


If your code is:

oObject:SomeThing := oSomeThing
oObject:ExecuteMethod()

the following may be have a slightly bit better performance 

oObject:ExecuteMethod( oSomething )

but only if ExecuteMethod is strong typed.
If ExecuteMethod() cannot be strong typed, you should assign oSomething
to a local typed variable as first thing, so the compiler can generate
better code.

If you need the same Something object more times, then an assign to an
instance variable (export or protect) is better because every parameter
passing requires time.


HTH

Wolfgang

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Self:Variable vs parameter Martin <spam@spam.spam> - 2012-08-29 15:46 +0100
  Re: Self:Variable vs parameter "Wolfgang Riedmann" <wriedmann@gmail.com> - 2012-08-29 15:21 +0000
    Re: Self:Variable vs parameter Martin <spam@spam.spam> - 2012-08-29 16:35 +0100
      Re: Self:Variable vs parameter "Wolfgang Riedmann" <wriedmann@gmail.com> - 2012-08-29 15:39 +0000

csiph-web