Subject: bug#21514: Guile 2.2: Sluggish elf calls, esp around arity / promises / statprof

From: Andy Wingo <[email-masked]>
Date: Fri, 24 Jun 2016 13:37:11 +0200

I'm happy with this fix!  However I think I would like to see if I can
just speed up thunk? and other arity accessors.  Do you have a test
case that you can use to show the speed problem?

Andy

On Sat 14 Nov 2015 03:54, Christopher Allan Webber <[email-masked]> writes:

> Here's a fix to this bug.  Tests pass, and performance appears to be
> back here.
>
> I've assigned copyright to the FSF for Guile so it should be fine to
> commit!
>
>
>>>From 79e3b5286a2699f9b302bd3abf8a6b884b13a4f4 Mon Sep 17 00:00:00 2001
> From: Christopher Allan Webber <[email-masked]>
> Date: Fri, 13 Nov 2015 20:42:31 -0600
> Subject: [PATCH] Remove thunk / arity check in make-promise
>
> * libguile/promises.c (s_scm_make_promise): Remove arity check in
>   make-promise.  This was causing considerably slowdown with the new elf
>   code, causing considerable number of bytevector reading calls on
>   every call to (make-promise).  Removing this check fixes a performance
>   regression in the new compiler.
> ---
>  libguile/promises.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libguile/promises.c b/libguile/promises.c
> index dcd0ac3..858b6f3 100644
> --- a/libguile/promises.c
> +++ b/libguile/promises.c
> @@ -1,4 +1,4 @@
> -/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011
> +/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2015
>   * Free Software Foundation, Inc.
>   * 
>   * This library is free software; you can redistribute it and/or
> @@ -77,7 +77,6 @@ SCM_DEFINE (scm_make_promise, "make-promise", 1, 0, 0,
>              "@end lisp\n")
>  #define FUNC_NAME s_scm_make_promise
>  {
> -  SCM_VALIDATE_THUNK (1, thunk);
>    SCM_RETURN_NEWSMOB2 (scm_tc16_promise,
>  		       SCM_UNPACK (thunk),
>  		       SCM_UNPACK (scm_make_recursive_mutex ()));