[tarantool-patches] Re: [PATCH] sql: LIKE/LENGTH process '\0'
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Wed Feb 20 21:08:01 MSK 2019
On 20/02/2019 19:04, n.pettik wrote:
>
>
>> On 20 Feb 2019, at 18:47, i.koptelov <ivan.koptelov at tarantool.org> wrote:
>>
>> Thanks to Alexander, I fixed my patch to use a function
>> from icu to count the length of the string.
>>
>> Changes:
>>
>
> Look, each next implementation again and again changes
> results of certain tests. Lets firstly define exact behaviour of
> length() function and then write function which will satisfy these
> requirements, not vice versa. Is this the final version?
> Moreover, since Konstantin suggest as fast implementation
> as we can, I propose to consider sort of asm written variant:
>
> .global ap_strlen_utf8_s
> ap_strlen_utf8_s:
> push %esi
> cld
> mov 8(%esp), %esi
> xor %ecx, %ecx
> loopa: dec %ecx
> loopb: lodsb
> shl $1, %al
> js loopa
> jc loopb
> jnz loopa
> mov %ecx, %eax
> not %eax
> pop %esi
> ret
>
>
> It is taken from http://canonical.org/~kragen/strlen-utf8
> and author claims that quite fast (seems like it doesn’t
> handle \0, but we can patch it). I didn’t bench it, so I am
> not absolutely sure that it ‘way faster’ than other implementations.
https://github.com/Gerold103/tarantool-memes/blob/master/further%20from%20god.jpg
More information about the Tarantool-patches
mailing list