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

From: John Clements (clements at brinckerhoff.org)
Date: Tue Dec 12 14:51:48 EST 2006

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?

To run, if you care: with module wrapper commented out,

mzscheme -fmv pentominoes.ss

with module wrapper uncommented:

mzscheme -tmv pentominoes.ss

Any thoughts appreciated.

Thanks,

John Clements


sample runs:

computer:/tmp clements$ mzscheme -fmv pentominoes.ss
placements per second: 1522.0700152207
placements per second: 1641.2276382734285
^Cuser break

=== context ===
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
...

computer:/tmp clements$ mzscheme -tmv pentominoes.ss
placements per second: 1220.8521548040533
placements per second: 1320.6550449022716
^Cuser break

=== context ===
/private/tmp/pentominoes.ss:152:20
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
/private/tmp/pentominoes.ss:32:6: row-loop
/private/tmp/pentominoes.ss:291:39
/private/tmp/pentominoes.ss:34:10: col-loop
...



-------------- next part --------------
A non-text attachment was scrubbed...
Name: pentominoes.ss
Type: application/octet-stream
Size: 9354 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20061212/e28009ba/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20061212/e28009ba/attachment.p7s>

Posted on the users mailing list.