[racket] for/hash and for/list: adding nothing, adding more than one thing
On Wed, Mar 27, 2013 at 4:46 AM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:
> I can't really test what you've posted (no stress-testing code), and you also compare safe versus unsafe accessors, which skews things.
It was not meant to be testable code, just an example to frame the
specific case I was talking about.
When I did the test both fragment were using the same kind of
accessors, of course.
Attached there is a complete runnable program (with both procedures
using unsafe accessors).
I obtain these timings:
using risolvi-2 (nested fors):
> (time (test 1000 "e:/Local/Documents/Scheme/temp-3"))
cpu time: 16234 real time: 16286 gc time: 78
> (time (test 1000 "e:/Local/Documents/Scheme/temp-3"))
cpu time: 16453 real time: 16493 gc time: 63
using risolvi-3 (a single for*):
> (time (test 1000 "e:/Local/Documents/Scheme/temp-3"))
cpu time: 18078 real time: 18184 gc time: 1313
> (time (test 1000 "e:/Local/Documents/Scheme/temp-3"))
cpu time: 17735 real time: 17810 gc time: 141
This is a 10% difference on the the time for the whole program, which
comprises parts other than this loop, so the difference for the loop
only should be even greater.
Cheers
P.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sexomini-con-for.rkt
Type: application/octet-stream
Size: 16808 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20130327/06e42bb4/attachment.obj>