On 14.08.2011 22:00, Levente Uzonyi wrote:
> On Sun, 14 Aug 2011, Philippe Marschall wrote:
> 
>> Hi
>>
>> In Seaside we get a lot of performance gains out of
>> primitiveFindFirstInString. One thing that always annoyed me a bit is
>> that it's not as optimized as it could be.
>>
>> The inclusionMap you give it are 256 consecutive boolean values (0 or
>> 1). There is no need for this to be a 256 element ByteArray when each
>> element can only be 0 or 1. We could as well make it a 32 element
>> ByteArray and each byte holding eight bit values. Instead of using the
>> asciiValue to directly index into the inclusionMap we would use the top
>> five bits to index into the inclusionMap and the bottom 3 bits to "index
>> into the byte".
>>
>> Did that make any sense?
> 
> Do you want to save space?

I'm trying to trade memory access (which is slow) for a bit shift and
two bit ands (which is fast).

> Are you storing lots of inclusion maps (maybe
> CharacterSets)? If not, then IMHO it's not worth to adding this feature
> to this primitive, because runtime performance will be worse on both the
> image side and the VM side.

Why?

Cheers
Philippe


Reply via email to