If there is a case statement that has thousands of choices there is probably a better data structure to implement it.
A case statement based on ordinals can't be improved by static analysis, since it is based on a jump table.
I wonder what the limitations are for case statements within case statements....
I'd expect those to be precisely the same as for the outer case. Fundamentals of block structured compilers... I think I've tried to make the point that understanding that sort of thing is useful to you in the past.
Having said which... where a language retained some sort of intermediate representation during execution, i.e. relying on a JITC etc., it might be possible to optimise by breaking the original jump table up into smaller chunks some of which relied on locality of code i.e. how much would fit into a cache, using near jumps where possible and so on. The end result might possibly be more efficient than the initial jump table, but there would be a long period of runtime optimisation where the implied "instrumentation" of the code would result in its running significantly less efficiently than the original.
MarkMLl