Re: srfi-129 (titlecase) comments
Per Bothner 13 Jan 2016 05:04 UTC
On 01/12/2016 05:45 PM, John Cowan wrote:
>> Kawa has fast switches on integers - as does many other language
>> implementations. It would be nice if the mapping tables where in a
>> macro-friendly format, so they could be transformed into association
>> lists, hash tables, or case expressions with some file inclusion and
>> macros.
>
> Is the implementation of switches fast over such a large range of keys?
Yes - that was the result of a Google Summer of Code (by Andrea Bernardini):
A case expression where all the keys are fixnums (and some other cases)
gets translated the same as a Java switch: Either a tableswitch or a lookupswitch
instruction. The latter uses binary search. (A hash lookup is also possible.)
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/