Iñaki Baz Castillo
3/2/2009 10:59:00 PM
El Lunes, 2 de Marzo de 2009, Brian Candler escribi=C3=B3:
> I=C3=B1aki Baz Castillo wrote:
> > Yes, doing a benchmark the result is more or less the same (any other
> > factor
> > seems to be more important), but what I want to know is what should be
> > the
> > response based on how Ruby works. Under my understanding Ruby needs to
> > parse
> > during runtime the variable name so a longer variable name would require
> > more
> > time, am I wrong?
>
> I believe you're wrong.
>
> Symbols are resolved into references to the symbol table at parse time,
> so when running, :s and :ssssssssssssssss are just two different
> pointers into the same symbol table. As for local variables, they are
> just offsets into the stack frame.
>
> So it might take a microscopically small amount of extra time for your
> program to start up, reading a few extra bytes of source code, but once
> it's running, each iteration should take the same time.
Thanks, that makes sense :)
=2D-=20
I=C3=B1aki Baz Castillo