unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Luca Saiu <positron@gnu.org>
Cc: bug-guile@gnu.org
Subject: Re: High run time variance
Date: Thu, 05 Aug 2010 16:45:41 +0200	[thread overview]
Message-ID: <m34of92k4q.fsf@unquote.localdomain> (raw)
In-Reply-To: <4C5ABFAB.2080006@gnu.org> (Luca Saiu's message of "Thu, 05 Aug 2010 15:42:03 +0200")

Hi,

On Thu 05 Aug 2010 15:42, Luca Saiu <positron@gnu.org> writes:

> ;;; Why does this GCs after creating b?  Try running this with GC_PRINT_STATS=1,
> ;;; or with GC_DONT_GC=1 if you want to see the memory use rise.
>
> (define size 100000)
> (define times 100)
>
> (define b (make-bitvector size))
>
> (do ((t 0 (1+ t)))
>     ((= t times) 'done)
>   (do ((i 0 (1+ i)))
>       ((= i size) 'done)
>     (bitvector-set! b i #t)))

The toplevel references to bitvector-set! don't get cached, so the
bitvector-set! gets looked up every time, and there is some unfortunate
allocation in scm_from_locale_symboln. If you put it in a function,
the variable gets cached, and there's no allocation.

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2010-08-05 14:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 16:09 High run time variance Luca Saiu
2010-03-30  9:16 ` Ludovic Courtès
2010-03-30 12:35   ` Luca Saiu
2010-03-30 13:01     ` Ludovic Courtès
2010-03-30 15:05       ` Luca Saiu
2010-08-04 19:51 ` Andy Wingo
2010-08-05 13:42   ` Luca Saiu
2010-08-05 14:45     ` Andy Wingo [this message]
2010-08-05 16:21       ` Luca Saiu
2010-08-05 17:43         ` Andy Wingo

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=m34of92k4q.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=bug-guile@gnu.org \
    --cc=positron@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).