Thanks nicolas so we can use them then. 

> On 10 Apr 2019, at 11:59, Nicolas Cellier 
> <nicolas.cellier.aka.n...@gmail.com> wrote:
> 
> VMMaker.oscog-sk.2367
> Author: sk
> Time: 19 April 2018, 12:02:35.661622 pm
> UUID: 0c2401e3-1450-4f73-8e81-958f50171595
> Ancestors: VMMaker.oscog- nice.2366
> 
> ** new primitive to compare strings (slang + JIT)
> answers negative smi, 0 or positive smi (instead of 1, 2 or 3 in the 
> MiscPlugin)
> 
> * Slang (primitiveCompareWith)
> order is optionnal. 
> comparison loop performed in rawCompare: string1 length: strLength1 with: 
> string2 length: strLength2 accessBlock: accessBlock
> 
> * JIT (genPrimitiveStringCompareWith)
> the JIT primitive does not take order as parameter (assumed asciiOrder)
> quick jump if one of the strings is empty
> 
> Le mer. 10 avr. 2019 à 11:56, ducasse <steph...@netcourrier.com 
> <mailto:steph...@netcourrier.com>> a écrit :
> 
> 
>> On 10 Apr 2019, at 11:42, Cyril Ferlicot <cyril.ferli...@gmail.com 
>> <mailto:cyril.ferli...@gmail.com>> wrote:
>> 
>> On Wed, Apr 10, 2019 at 10:42 AM Stéphane Ducasse
>> <stephane.duca...@inria.fr <mailto:stephane.duca...@inria.fr>> wrote:
>>> 
>>> Hi
>>> 
>>> I recall that clement told me that returning 1,2 or 3 instead of negative, 
>>> zero, positive was slow.
>>> And I wonder if the primitive got change to the logic clement proposed?
>>> 
>>> Could we not introduce another primitive and use it from the image?
>> 
>> Hi,
>> 
>> I think Sophie already did most of the work to introduce a new
>> primitive. The missing steps to use the new optimized way to compare
>> strings are:
>> - Add the primitive to the primitive table VM side for Pharo/Squeak and 
>> Newspeak
> 
> If you know that it is done from the VM side let us know. 
> 
>> - Use the new primitive in the image and call this one for string comparison
>> 
>> With this new primitive performances on string comparison can be
>> improved around x2.5 to x5 times faster.
>> 
>>> 
>>> compare: string1 with: string2 collated: order
>>> "Return 1, 2 or 3, if string1 is <, =, or > string2, with the collating 
>>> order of characters given by the order array."
>>> 
>>> | len1 len2 c1 c2 |
>>> <primitive: 'primitiveCompareString' module: 'MiscPrimitivePlugin'>
>>> <var: #string1 declareC: 'unsigned char *string1'>
>>> <var: #string2 declareC: 'unsigned char *string2'>
>>> <var: #order declareC: 'unsigned char *order'>
>>> 
>>> len1 := string1 size.
>>> len2 := string2 size.
>>> 1 to: (len1 min: len2) do:
>>> [:i |
>>> c1 := order at: (string1 basicAt: i) + 1.
>>> c2 := order at: (string2 basicAt: i) + 1.
>>> c1 = c2 ifFalse:
>>> [c1 < c2 ifTrue: [^ 1] ifFalse: [^ 3]]].
>>> len1 = len2 ifTrue: [^ 2].
>>> len1 < len2 ifTrue: [^ 1] ifFalse: [^ 3].
>>> 
>>> --------------------------------------------
>>> Stéphane Ducasse
>>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/>
>>> http://www.synectique.eu <http://www.synectique.eu/> / http://www.pharo.org 
>>> <http://www.pharo.org/>
>>> 03 59 35 87 52
>>> Assistant: Julie Jonas
>>> FAX 03 59 57 78 50
>>> TEL 03 59 35 86 16
>>> S. Ducasse - Inria
>>> 40, avenue Halley,
>>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
>>> Villeneuve d'Ascq 59650
>>> France
>>> 
>> 
>> 
>> -- 
>> Cyril Ferlicot
>> https://ferlicot.fr <https://ferlicot.fr/>

Reply via email to