unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Subject: Re: [PATCH] experimental lookupcar based coverage testing.
Date: Fri, 19 Jan 2007 14:49:22 +0100	[thread overview]
Message-ID: <45B0CC62.7020705@xs4all.nl> (raw)
In-Reply-To: <87lkjz40zc.fsf@laas.fr>

Ludovic Courtès escreveu:
>> See attached patch. This still has rough edges. For some reason, I
>> don't catch the memoization of display to #<proc: display>.
> 
> Overall, as Kevin suggested, I'd be more in favor of using the existing
> trap mechanism (possibly extending it if it doesn't provide enough
> information to trap handlers).  However, as you already said, the trap
> mechanism is damn slow.  I guess it is mostly slow because the evaluator
> is slow, but the trap mechanism itself may be optimizable, too.
> 
> If you look at `ENTER_APPLY' around line 3025, it makes at least two
> function calls: `scm_make_debugobj ()' and `scm_call_3 ()'.  The former
> is a one-line function and should really be inlined.  The latter
> introduces unnecessary overhead since it ends up calling `SCM_APPLY ()'
> which in turns necessarily jumps to the `scm_tcs_closures' case since
> trap handlers are always closures.  Thus, at the very least,
> `scm_call_3 ()' should be replaced by `SCM_APPLY ()'.
> 
> These small optimizations would certainly be worthwhile, although
> perhaps not sufficient.

I have doubts whether this can ever be good enough. For effective
coverage analysis, you have a to run an entire test-suite with
coverage enabled.  Eg. for lilypond, the entire test-suite takes 5
minutes on a 1.6ghz Core duo (single thread), when running
normally. That is a lot of Scheme code, and if for every frame-enter
or apply, a piece of user code is called, that will be an enormous
slowdown.

The real problem is not setting up the trap for calling, but rather 
the fact that it 

 - is called for every evaluation (for coverage, it needs to be done
only once)

 - is user-code, ie. something as simple as

  (car x)

(which is just a couple of instructions) will expand into

   (begin
    (vector-set! 
     (hash-ref coverage-table
      (source-property (frame-source (last-frame continuation))
       'filename))
     (source-property (frame-source (last-frame continuation)) 'line)
     #t)
    (car x))

which would likely be a couple of orders of magnitude slower.
  
Of course, the patch that I posted is ad-hoc, because it hardcodes the
coverage analysis in eval.c.  If it were to be included, I propose
something like

 (trap-set! 'memoize-symbol
            record-coverage)
 (trap-enable 'memoize-symbol)

which would be possible with a generic, and quite minimal extension to
eval.

However, I'd like some feedback on the approach before reworking the
ad-hoc patch into a real one.



-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2007-01-19 13:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-18 19:48 [PATCH] experimental lookupcar based coverage testing Han-Wen Nienhuys
2007-01-18 23:50 ` Kevin Ryde
2007-01-19 10:40   ` Han-Wen Nienhuys
2007-01-23  0:50     ` Kevin Ryde
2007-01-19 12:56 ` Han-Wen Nienhuys
2007-01-19 13:09 ` Ludovic Courtès
2007-01-19 13:49   ` Han-Wen Nienhuys [this message]
2007-01-19 16:05     ` Ludovic Courtès
2007-01-19 20:14       ` Han-Wen Nienhuys
2007-01-20 15:01         ` Ludovic Courtès
2007-01-22 14:49           ` Han-Wen Nienhuys
2007-01-22 15:39             ` 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=45B0CC62.7020705@xs4all.nl \
    --to=hanwen@xs4all.nl \
    /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).