Subj : Re: int8 for property enum? To : netscape.public.mozilla.jseng From : Brendan Eich Date : Mon Feb 02 2004 01:27 pm Brendan Eich wrote: > Why tinyids, anyway? They exist so you can have a class getter or > setter, or even a getter/setter shared among a set of properties, and > you want the common getter/setter to switch on an int id of some > sort. That's what tinyids are for; they make for dense switches, and > generally you don't need anywhere near more than a hundred or so > well-known properties per built-in object class. To finish this story, the shared getter or setter has common prolog and epilog code around the switch on N tinyid cases, that would otherwise have to be subroutined, or duplicated, among N distinct getters or setters. This common prolog and epilog code can be big enough that the code size reduction from sharing is worth the small cycle hit of the switch statement. Code size vs. cycle is an apples to oranges trade-off, of course; YMMV. /be .