guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fmatch


From: Ludovic Courtès
Subject: Re: fmatch
Date: Fri, 07 May 2010 13:59:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi Stefan,

stefan <address@hidden> 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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]