[gambit-list] [PATCH] Patch to speed string comparisons and hashing

Christian Jaeger christian at pflanze.mine.nu
Sat Feb 23 15:21:57 EST 2008


Bradley Lucier wrote:
> As to Christian's comments about unresponsiveness---there are already  
> many tight loops in the gambit runtime that disable interrupts to  
> gain performance.  I think if you want to throw around strings that  
> are hundreds of megabytes long then you are willing to accepts some  
> unresponsiveness.
>   

Well, not necessarily; garbage collection may still run fast since still 
objects don't have to be copied, and maybe there are no (other) places 
that require locking times proportional to the size of objects, I don't 
know. Well, I'm the one having suggested to use separate unix processes 
for independence a few times, and I don't have any numbers, so I won't 
protest. But I suggest to make the purpose of such optimizations visible 
and easily removable in the sources. I've made an alternative patch with 
that change (it also defines the combine macro only once--avoid 
duplication whenever possible).

Be aware that this is untested: I wanted to test it, but couldn't figure 
out how to compile Gambit from Mercurial.

The Page 
http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/How_to_Contribute 
suggests this should work:

$ make bootstrap
making all in include
make[1]: Entering directory 
`/home/chris/schemedevelopment/gambit/gambit.git/include'
make[1]: Leaving directory 
`/home/chris/schemedevelopment/gambit/gambit.git/include'
making all in lib
make[1]: Entering directory 
`/home/chris/schemedevelopment/gambit/gambit.git/lib'
LD_LIBRARY_PATH=../lib:../gsi:../gsc: ../gsc-comp -:=.. -f -c -check _io.scm
/bin/sh: ../gsc-comp: No such file or directory
make[1]: *** [_io.c] Error 127
make[1]: Leaving directory 
`/home/chris/schemedevelopment/gambit/gambit.git/lib'
make: *** [all-recursive] Error 1

If I symlink gsc from my previous Gambit installation on that machine 
(4.0 beta 21), I'm getting:

...
make[1]: Entering directory 
`/home/chris/schemedevelopment/gambit/gambit.git/lib'
LD_LIBRARY_PATH=../lib:../gsi:../gsc: ../gsc-comp -:=.. -f -c -check _io.scm
gcc -I../include -I. -Wall -W -Wno-unused -O1 -fno-math-errno 
-fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv 
-fomit-frame-pointer -fPIC -fno-common -mieee-fp -DHAVE_CONFIG_H 
-D___PRIMAL -D___LIBRARY -D___GAMBCDIR="\"/usr/local/Gambit-C/v4.2.2\"" 
-D___SYS_TYPE_CPU="\"i686\"" -D___SYS_TYPE_VENDOR="\"pc\"" 
-D___SYS_TYPE_OS="\"linux-gnu\"" -c _io.c
In file included from _io.c:1248:
../include/gambit.h:19:30: error: gambit-not402002.h: No such file or 
directory
In file included from _io.c:1248:
../include/gambit.h:6609: error: expected specifier-qualifier-list 
before '___SCMOBJ'
../include/gambit.h:6672: error: expected specifier-qualifier-list 
before '___U32'
../include/gambit.h:6683: error: expected specifier-qualifier-list 
before '___U32'
../include/gambit.h:6728: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before '___symkey_struct'
...

Creating an empty gambit-not402002.h file in the include directory (it's 
being included by the include/gambit.h file) doesn't help.

What's the problem?


BTW I've started playing around with Tailor(*) to convert between 
Mercurial and Git; you can see the two changes of my patch in separate 
pieces from the following gitweb URL:

http://scheme.mine.nu/dyn/gitweb?p=gambit;a=shortlog;h=refs/heads/stringspeedup

But I haven't found out yet how to merge the Git changesets back to 
Mercurial (Tailor docs suggest it is possible).

Christian.

(*) http://wiki.darcs.net/DarcsWiki/Tailor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my-patch2.diff
Type: text/x-diff
Size: 4547 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20080223/2f19f3c1/attachment.diff>


More information about the Gambit-list mailing list