Efficient thread-local shared variables
Klaus D. Witzel
klaus.witzel at cobss.com
Tue Oct 24 05:33:00 UTC 2006
Hi Andreas,
on Tue, 24 Oct 2006 06:46:26 +0200, you wrote:
> Folks -
>
> For a variety of reasons I am in dire need of the ability to vector
> shared variables (globals, class vars and pool vars) through an extra
> indirection vector per process (really per island but binding per
> process seems to be simpler for now). Since I need this for *each and
> every shared variable* it needs to be *very* efficient.
>
> The question is: What is the most efficient way to implement such a
> scheme?
The fastest indirect access is through literal variables (limited only by
the # of literals allowed per method).
Since you are willing to spend a #symbol per variable, formally declare a
"descriptor" to be a class var (or use a pool). Take #PerProcessThing as
as example; initialize PerProcessThing to a subinstance of Association
which holds a fast and fixed Array index.
Then all you need in the scope of activeProcess is a shared Array which is
indexed by the above machinery. Example use:
PerProcessThing localSharedValue
PerProcessThing localSharedValue: somethingElse
Not counting "Processor activeProcess scope", the above is the fastest
double-indirect access that I can think of.
/Klaus
More information about the Squeak-dev
mailing list
|