I renamed sigma to map-sum. While sigma is a cute name, it's kind of
obscure and just another thing to remember. For those of you who
never used the sigma (now map-sum) word, the map-sum word is just a
more efficient version of "map sum" that doesn't construct an
intermediate sequence. Notice how "map sum" triggers a garbage
collection and map-sum doesn't.
Doug
: foo ( seq -- n ) [ sq ] map sum ;
: bar ( seq -- n ) [ sq ] map-sum ;
[ 1000000 iota foo ] time
== Running time ==
0.151428 seconds
== Garbage collection ==
Times are in microseconds.
Nursery Aging Tenured
GC count: 18 0 0
Total GC time: 3925 0 0
Longest GC pause: 3805 0 0
Average GC pause: 218 0 0
Objects copied: 360 0 0
Bytes copied: 30408 0 0
Total GC time: 3925
Cards scanned: 31395
Decks scanned: 71
Card scan time: 3787
Code heap literal scans: 3
[ 1000000 iota bar ] time
== Running time ==
0.028201 seconds
== Garbage collection ==
Times are in microseconds.
Nursery Aging Tenured
GC count: 0 0 0
Total GC time: 0 0 0
Longest GC pause: 0 0 0
Average GC pause: 0 0 0
Objects copied: 0 0 0
Bytes copied: 0 0 0
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk