unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: stefan <stefan.tampe@spray.se>
To: guile-devel@gnu.org
Subject: Re: fmatch
Date: Sun, 9 May 2010 22:52:01 +0200	[thread overview]
Message-ID: <201005092252.01307.stefan.tampe@spray.se> (raw)
In-Reply-To: <87vdaw6bf2.fsf@gnu.org>

On Sunday 09 May 2010 10:57:21 pm Ludovic Courtès wrote:
> Hi!
> 
> stefan <stefan.tampe@spray.se> writes:
> >> Hmmmm.  My first reaction is that I’d rather avoid complex VM
> >> instructions like this and instead focus on native compilation (AOT or
> >> JIT) when we feel like improving performance.
> >>
> >> What do you think?
> >
> > Well, I think that for plain pattern matching, a sane compilation is the
> > way to go in the long run. For unification I'm not sure.
> 
> OK.  I was just thinking about (ice-9 match).  Let’s start a separate
> thread for unification.  :-)

In a sense they are close actually But as you say let's push the unification
onto the stack!!

Actually (ice-9 match) has quit a lot of power and I would try keeping it a 
little thinner in the beginning for a speedier version.
 
> >> For 2.2 and beyond, I really think the focus should be on allowing hot
> >> spots to be written in Scheme, which means compiling Scheme code
> >> natively.  This would be beneficial to all Scheme code, not just this
> >> specific pattern matching construct.
> >
> > This is clearly a good move. Hmm Ok, I see your point here. I could write
> > the whole stuff out in scheme directly. Hmm it would still be nice to
> > have an implemenation in C and compare with what you get when introducing
> > this code. Also one should focus on stuff in the right order. So if I
> > spend the next
> > two weeks writing a small prolog implementaion. Should we wait untill
> > after 2.2 to get the suggested speed and live with 15x performance hit?
> > It is tempting to deliver that system and then spend the next years to
> > shoot it down into pure scheme.
> 
> Don’t hold your breath: native compilation won’t show up overnight.  ;-)

No problem. But then we might think about supporting some faster version.

> You /can/ implement hotspots in C, but you most likely don’t need to
> write special VM instructions for that.  Instead, you could probably
> implement primitive procedures in C (info "(guile) Primitive
> Procedures").

You then need to translate the action scheme code into a lambda and execute
that. That could work, I'll keep this as an option.

e.g.

(match x ((a b) (+ a b)))

(let ((F (lambda (a b) (+ a b))))
  (c-code-match x pat F))

This has it's elegance. So do you see any performancs 
issues using this?

/Stefan
		




  reply	other threads:[~2010-05-09 20:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06 20:39 fmatch stefan
2010-05-07 11:59 ` fmatch Ludovic Courtès
2010-05-07 14:24   ` fmatch stefan
2010-05-07 20:23     ` fmatch Ludovic Courtès
2010-05-07 20:53       ` fmatch stefan
2010-05-09 20:57         ` fmatch Ludovic Courtès
2010-05-09 20:52           ` stefan [this message]
2010-05-10  8:26             ` fmatch Ludovic Courtès
2010-05-11 14:26               ` fmatch Stefan
2010-05-17 20:08               ` fmatch stefan
2010-05-22 21:03                 ` fmatch Ludovic Courtès
2010-05-22 21:31                   ` fmatch stefan
2010-05-23 16:06                     ` fmatch Ludovic Courtès
2010-05-23 15:47                   ` fmatch stefan
2010-05-24 20:08                     ` fmatch Ludovic Courtès
2010-05-24 21:05                       ` fmatch stefan
2010-05-25 17:41                         ` fmatch Ludovic Courtès
2010-05-25 21:10                           ` fmatch stefan
2010-06-16 21:31                             ` fmatch Ludovic Courtès
2010-06-20 19:58                               ` fmatch stefan
2010-06-20 21:56                                 ` fmatch Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201005092252.01307.stefan.tampe@spray.se \
    --to=stefan.tampe@spray.se \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).