Nesting DynamicVariables

Lukas Renggli renggli at
Sat Oct 27 19:34:05 UTC 2007

> How performant are these DynamicVariable lookups?

They are quite performant, if your stack has a reasonable size and you
are calling the lookup a reasonable number of times. There is a
primitive in the VM that answers the next context possible handler.

I remember a project where dynamic variables were used to translate
every individual string displayed on the page. The rendering was not
measurably slower than in the untranslated case.

If you need raw speed, it might be smart to add an additional variable
to Process which provides you with O(1) performance. However since
this is much trickier to port, we don't use it in Seaside.

I am co-author of an not yet published paper that compares the two
approaches in the discussion. The observed numbers for 10^6 queries
are the following:

	Stack depth	Dynamic Variables	Process Variable
	0			7455 ms			258 ms
	100			7967 ms			258 ms
	1000		17883 ms			255 ms


Lukas Renggli

More information about the Squeak-dev mailing list