\ modified (find) uses a bubble sort on found words by moving the latest found word up
\ one position in the linked list
\ in general this seems to be of no significant advantage, it may even decrease
\ compiler speed.
\ In applications doing lots of word searches in large vocabularies this could improve
\ search speed a lot.
\ hs 09.12.97
??cr .( installing bubble sort find)
code (fastfind)	\ ( string link origin -- cfa true | str false )
		r5	sp	pop	\ r5: link
		r8	0 #	mov
		r7	0 #	mov
		r0	sp )	ldr	\ r0: string
		r6	r0 byte ) ldr
    begin	r5	top	cmp
 ge while	r1	r5 /link # add	\ bump to name field
		r0	sp )	ldr	\ r0 is string address
		r2	r6 /char # add	\ r2 is string length
       begin	r2	1	s decr
    ge while	r3	r1 byte )+ ldr
		r4	r0 byte )+ ldr
		r3	r4	cmp	\ char match ?
    eq repeat
		r2	0 #	cmp	\ all chars tested ?
       lt if
		r2	r1 /cell #	add	\ r1 points to flags byte
		r2	r2 /cell 1- #	bic	\ r2 points to (aligned) cfa
		r3	r1 byte ) ldr	\ r3 holds flags byte
		r3	h# 20 #	tst	\ check alias bit
		r2	r2 )	ne ldr	\ Get referent of alias
		r2	sp )	str	\ push cfa
		r3	h# 40 #	tst	\ check immediate bit
		top	1 #	ne mov	\ -> immediate
		top	-1 #	eq mov
		r8	0 #	cmp
	 ne if	r1	r5 )	ldr	\ swap links
		r5	r8 )	str
		r7	r5 )	str
		r1	r7 )	str
	 then	next
       then				\ no match -> get next word
		r8	r7	mov
		r7	r5	mov
		r5	r5 )	ldr	\ get next link
   repeat	top	0 #	mov c;	\ havn't found it

patch (fastfind) (find) vfind
