chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Improve irregex matching performance a lot


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Improve irregex matching performance a lot by adding two type declarations
Date: Sat, 12 Dec 2015 15:44:57 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Dec 09, 2015 at 08:59:17AM +0100, Peter Bex wrote:
> On Tue, Dec 08, 2015 at 10:35:35PM +0100, address@hidden wrote:
> > > Now, if you look at the patch you'll see that it changes irregex-core.scm,
> > > which means it creates a "fork" against that part of the code in upstream.
> > > I don't see a way to declare the type from the "outside", in irregex.scm,
> > > unless we also copy that code body as a macro, but that feels really ugly
> > > and will cause some code duplication in the resulting C code.
> > 
> > I suggest creating a wrapper macro for "assume" with an (empty) 
> > cond-expand'ed default
> > definition and send this to upstream. If this change has such an impact, 
> > then other
> > implementations might take advantage from type-declarations as well.
> 
> Hm, I hadn't considered that.  I'll have to look over the other Schemes
> and how their type systems work, and give this some more thought.
> Thanks for the suggestion!
> 
> So for now, please don't apply this patch; I might send a new one with
> the upstream change, if any (otherwise I'll resend this one).

Please apply the previous patch anyway (I've attached it again for
convenience).

I've looked over the manual of several Schemes, and it turns out none
of them have a typing system that works like CHICKEN's.  AFAIK only
Racket really has a typing system at all, and it seems to be a completely
separate language, one which you can't use just for one procedure inside
a regular Racket program.  I've also tested Gambit's local "unsafe"
declaration, but it had almost zero impact on the performance of the
procedure (which is a bit strange I suppose).

And even if there are other Schemes with type hints (I'd love to hear if
I've overlooked any!), I doubt they use a compatible syntax to ours,
which means a wrapper macro would be pretty hairy.  So unless anyone has
any good idea on how to make a portable macro that improves performance
in more Schemes than just CHICKEN, I would just apply this as a "fork"
for us.

Maybe this is a good feature to add: a way to indicate that a type
declaration for the argument types to a procedure declared elsewhere
should be considered an assumption in the procedure body.  This way
it would not only affect callers, but also the procedure itself, which
makes it easy to improve performance of portable libraries without
hacking them to pieces.

Cheers,
Peter

Attachment: 0001-Improve-irregex-matching-performance.chicken-5.patch
Description: Text Data

Attachment: 0001-Improve-irregex-matching-performance.master.patch
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

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