[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: High run time variance
From: |
Andy Wingo |
Subject: |
Re: High run time variance |
Date: |
Thu, 05 Aug 2010 16:45:41 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi,
On Thu 05 Aug 2010 15:42, Luca Saiu <address@hidden> 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/