Re: Elisp performance

2009-08-08 Thread Ludovic Courtès
Hi! Andy Wingo writes: > Dynamic-wind, on the other hand, does pose a problem. The problem is > that dynamic-wind is a primitive -- to call it, the VM saves its > registers, conses together its arguments, and passes them to the > evaluator. The evaluator destructures the consed list, eventually

Re: Elisp performance

2009-08-04 Thread Andy Wingo
On Tue 04 Aug 2009 18:17, Daniel Kraft writes: > Andy Wingo wrote: >> Don't conjecture, profile ;-) > > I'd like to do so, but it seems that Guile does not include a profiler, > does it? A search turned up some patch/code, but I didn't get the > impression it would work very well -- do you have

Re: Elisp performance

2009-08-04 Thread Andy Wingo
On Tue 04 Aug 2009 18:12, Ken Raeburn writes: > On Aug 4, 2009, at 11:47, Andy Wingo wrote: >>> In any case, because of dynamic scoping and the expected behaviour of >>> flet to change possibly primitives during its extent, I think we >>> can't >>> do anything like that for Elisp (except providin

Re: Elisp performance

2009-08-04 Thread Daniel Kraft
Andy Wingo wrote: Don't conjecture, profile ;-) I'd like to do so, but it seems that Guile does not include a profiler, does it? A search turned up some patch/code, but I didn't get the impression it would work very well -- do you have some hints, getting some real profiling would be very u

Re: Elisp performance

2009-08-04 Thread Ken Raeburn
On Aug 4, 2009, at 11:47, Andy Wingo wrote: In any case, because of dynamic scoping and the expected behaviour of flet to change possibly primitives during its extent, I think we can't do anything like that for Elisp (except providing guile-primitive for hand-optimizing such calls). Hmm.

Re: Elisp performance

2009-08-04 Thread Ken Raeburn
On Aug 4, 2009, at 06:17, Andy Wingo wrote: Hello! (Was away for the weekend, but back hacking all week now.) Welcome back! On Thu 30 Jul 2009 22:18, Neil Jerram writes: Daniel Kraft writes: Lambda arguments are still always dynamically bound, which is quite a pity as it inhibits tail

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hi Ken, As a voice from the the sidelines, I just want to say thanks for all your input! On Thu 30 Jul 2009 05:23, Ken Raeburn writes: > Would [open-coding primitives] interfere with possibly blending Scheme > GOOPS code with Elisp someday? Or is the generic support there at a > lower level tha

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hi Daniel, On Wed 29 Jul 2009 14:50, Daniel Kraft writes: > For the timings, I used a simple prime sieve implemented imperatively > with while and set's, because the recursive one would put elisp without > tail-calls at a disadvantage (and because lexical binding does not yet > work for lambda a

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hi Daniel, On Fri 31 Jul 2009 17:14, Daniel Kraft writes: > Hi Ken, > > Ken Raeburn wrote: >> On Jul 31, 2009, at 02:02, Daniel Kraft wrote: > Iterative prime sieve, (length (find-primes-to 5000)): > Scheme: 0.42s > Elisp, no void checks, lexical let: 3.40s > Elisp, no void ch

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hello Daniel, On Fri 31 Jul 2009 08:02, Daniel Kraft writes: > Hi Neil, > > Neil Jerram wrote: >> Daniel Kraft writes: >>> Lambda arguments are still always dynamically bound, which is quite a >>> pity as it inhibits tail-call optimization; >> >> This prompted me to wonder if using fluids is t

Re: Elisp performance

2009-08-04 Thread Daniel Kraft
Andy Wingo wrote: Daniel Kraft writes: Lambda arguments are still always dynamically bound, which is quite a pity as it inhibits tail-call optimization; Indeed, a pity. Though self-tail calls can be optimized... still, irritating. Yes, but I fear this will complicate the compiler a lot and

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hi Daniel, On Fri 31 Jul 2009 08:09, Daniel Kraft writes: > Of course, anyone interested in performance can also use lexical-let > instead of let and also get rid of all this performance problems as well > ;) But the same argument may hold for the threading argument, too, so > if you want to wr

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hi, On Fri 31 Jul 2009 01:54, Ken Raeburn writes: > On Jul 30, 2009, at 16:18, Neil Jerram wrote: >> The main thing I believe that makes a fluid different from a normal >> variable is that a fluid can have a different value in each thread - >> which is not relevant to Elisp. > > Not yet, at leas

Re: Elisp performance

2009-08-04 Thread Andy Wingo
Hello! (Was away for the weekend, but back hacking all week now.) On Thu 30 Jul 2009 22:18, Neil Jerram writes: > Daniel Kraft writes: > >> Lambda arguments are still always dynamically bound, which is quite a >> pity as it inhibits tail-call optimization; Indeed, a pity. Though self-tail cal

Re: Elisp performance

2009-07-31 Thread Daniel Kraft
Hi Ken, Ken Raeburn wrote: On Jul 31, 2009, at 02:02, Daniel Kraft wrote: Iterative prime sieve, (length (find-primes-to 5000)): Scheme: 0.42s Elisp, no void checks, lexical let: 3.40s Elisp, no void checks, dynamic let: 4.43s Elisp, void checks, dynamic let: 5.12s Elisp, void checks, lexi

Re: Elisp performance

2009-07-31 Thread Ken Raeburn
On Jul 31, 2009, at 02:02, Daniel Kraft wrote: Iterative prime sieve, (length (find-primes-to 5000)): Scheme: 0.42s Elisp, no void checks, lexical let: 3.40s Elisp, no void checks, dynamic let: 4.43s Elisp, void checks, dynamic let: 5.12s Elisp, void checks, lexical let: 4.06s As Ken says,

Re: Elisp performance

2009-07-30 Thread Daniel Kraft
Ken Raeburn wrote: > And maybe that's enough. There's other stuff in Emacs besides variable bindings that would require dynamic-wind support, like flet, save-excursion (preserves current buffer and position), with-output-to-string and with-output-to-temp-buffer (preserve 'standard-output'), a

Re: Elisp performance

2009-07-30 Thread Daniel Kraft
Hi Neil, Neil Jerram wrote: Daniel Kraft writes: Lambda arguments are still always dynamically bound, which is quite a pity as it inhibits tail-call optimization; This prompted me to wonder if using fluids is the best way to implement dynamic binding. Perhaps I'm forgetting something basic,

Re: Elisp performance

2009-07-30 Thread Daniel Kraft
Ken Raeburn wrote: Obviously, it would help a lot to do so. On the other hand, switching to primitive-ref's would help even more, but I fear we can not easily do so, because we can not know if a symbol targets a primitive or was rebound at compile time... BTW, a quick test with Scheme: [

Re: Elisp performance

2009-07-30 Thread Ken Raeburn
On Jul 30, 2009, at 16:18, Neil Jerram wrote: The main thing I believe that makes a fluid different from a normal variable is that a fluid can have a different value in each thread - which is not relevant to Elisp. Not yet, at least. And maybe that's enough. There's other stuff in Emacs besid

Re: Elisp performance

2009-07-30 Thread Neil Jerram
Daniel Kraft writes: > Lambda arguments are still always dynamically bound, which is quite a > pity as it inhibits tail-call optimization; This prompted me to wonder if using fluids is the best way to implement dynamic binding. Perhaps I'm forgetting something basic, but surely it's using `dyna

Re: Elisp performance

2009-07-29 Thread Ken Raeburn
On Jul 29, 2009, at 08:50, Daniel Kraft wrote: Iterative prime sieve, (length (find-primes-to 5000)): Scheme: 0.42s Elisp, no void checks, lexical let: 3.40s Elisp, no void checks, dynamic let: 4.43s Elisp, void checks, dynamic let: 5.12s Elisp, void checks, lexical let: 4.06s It doesn't m