tx!
On 11 Apr 2019, at 14:42, Sophie Kaleba <sophie.kaleba@gmail.com> wrote:
HI, We actually talked about this very primitive with Cyril not that long ago. I'll have a look at it with him this week so it can be used !
Sophie
Le mer. 10 avr. 2019 à 14:10, ducasse <stepharo@netcourrier.com <mailto:stepharo@netcourrier.com>> a écrit : Thanks I did not know it was on a mailing-list.
On 10 Apr 2019, at 14:02, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com <mailto:nicolas.cellier.aka.nice@gmail.com>> wrote:
Hi Stephane, If you google 'vm-dev VMMaker.oscog-sk.2367' and click one of the first hits https://marc.info/?l=squeak-vm-dev&m=152413936110744&w=2 <https://marc.info/?l=squeak-vm-dev&m=152413936110744&w=2>
you'll see the changes from Sophie: The new InterpreterPrimitives>>primitiveCompareWith should be linked to primitive 158. (and only for ByteString comparison).
I did not try it, I have not much time to invest at the moment.
Le mer. 10 avr. 2019 à 13:52, ducasse <stepharo@netcourrier.com <mailto:stepharo@netcourrier.com>> a écrit : Nicolas
I tried to find the new primitive and I did not find it here
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/src/plugins/MiscP... <https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/src/plugins/MiscP...>
I found the old one. Did I look in the wrong place?
Stef
On 10 Apr 2019, at 13:46, ducasse <stepharo@netcourrier.com <mailto:stepharo@netcourrier.com>> wrote:
Thanks nicolas so we can use them then.
On 10 Apr 2019, at 11:59, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com <mailto:nicolas.cellier.aka.nice@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 <stepharo@netcourrier.com <mailto:stepharo@netcourrier.com>> a écrit :
On 10 Apr 2019, at 11:42, Cyril Ferlicot <cyril.ferlicot@gmail.com <mailto:cyril.ferlicot@gmail.com>> wrote:
On Wed, Apr 10, 2019 at 10:42 AM Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@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/>