Pete Lomax writes:
> There's no file level locals yet either ;-)
> 
> Can I ask a stupid question? Guess I'm going to anyway...
> 
> Is there much benefit to .const, over sticking a value in a register
> and not modifying it? (which is what I've done to get round this)

Yes.  First, if you want more than 8 constants of some type, this isn't
the way to go, as you'll starve your registers, and things will get
quite a bit slower.  And in general, registers are for things that
change.  The constant table is for constants.

> How much benefit for a heavily used 0/1 flag?

If it never changes?  None.  It'll load it up from the constant table
just as fast as it'll load it up from a register.  This may be different
in the presence of JIT and caching, two things which I know nothing
about. But in the general case, no benefit at all.

> What about a lightly used string?

Same deal.  Except here I'm pretty sure there's no JIT benefit.

Luke

Reply via email to