[plt-scheme] this code runs slower with modules?

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Dec 12 15:08:45 EST 2006

On Dec 12, John Clements wrote:
> My understanding is that--for the vast majority of mzscheme
> programs-- putting things in a module makes them faster, because
> non-mutated module-level bindings do not need to be boxed.
> 
> However, for the attached code, uncommenting the first and last
> lines--that is, wrapping them in a module--makes them run about 20%
> _slower_. Are there known circumstances in which wrapping things in
> modules makes them slower?

I get faster performance with the unit version:

  winooski:/ssh/ccs/tmp eli> mzscheme -tmv x.ss
  placements per second: 3454.231433506045
  placements per second: 3840.2457757296465
  placements per second: 3477.0514603616134

  winooski:/ssh/ccs/tmp eli> mzscheme -fmv x.ss
  placements per second: 2336.9946249123627
  placements per second: 2497.5024975024976
  placements per second: 2169.6680407897593

But one thing I finally learned from Matthew when doing such tests is
to always try both CGC and 3M.  In this case, the unit version still
has an advantage:

  winooski:/ssh/ccs/tmp eli> mzscheme -tmv x.ss
  placements per second: 4470.272686633884
  placements per second: 4732.60766682442
  placements per second: 4361.09899694723

  winooski:/ssh/ccs/tmp eli> mzscheme3m -fmv x.ss
  placements per second: 2525.890376357666
  placements per second: 2620.545073375262
  placements per second: 2487.5621890547263

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.