Hi Stefan, stefan <stefan.ta...@spray.se> writes:
> I've been experimenting lately with an inline match construct, very much like > using compiled regexps. Sounds interesting. > That is I created a tiny VM that was targeted to do matching. to show > it consider > > guile> (def f ((x y 'a 'b) (+ x y))) (Such a ‘def’ construct would be less convenient than ‘match’ IMO.) > large patterns yield a speedup of 15 times acording to my tests compared > with (ice-9 match). > > I used guile-1.9.10. Does this release have a lot of checks compiled in so > that the comparison is unfair? All list/pair accessors type-check their arguments (this has always been the case with Guile so that Scheme code cannot yield to segfaults and the like.) > Anyway, I will try to tweak the code even further somthing along > > (object-ref 1) > (fast-match) > (br L1) > (br L2) > (br L3) > .... > (br Ln) > > Here the fast-match routine can FETCH the br commands and issue them directly > and hence one can have one compiled pattern in stead of one for each row in > the matcher. I don’t quite understand how it differs from what happens without a ‘fast-match’ instruction. Can you show the code for ‘fast-match’? Thanks, Ludo’.