Paste: problem

Author: prunedtree
Mode: factor
Date: Wed, 15 Oct 2008 18:42:09
Plain Text |
( scratchpad ) Loading resource:work/morse2/morse2.factor
:warnings - print 5 semantic warnings.
USE: morse2
( scratchpad ) [ test ] time
==== RUNNING TIME

1890 ms

==== GARBAGE COLLECTION

                         Nursery Aging Tenured
GC count:                0       0     0
Cumulative GC time (ms): 0       0     0
Longest GC pause (ms):   0       0     0
Average GC pause (ms):   0       0     0
Objects copied:          0       0     0
Bytes copied:            0       0     0

Total GC time (ms):      0
Cards scanned:           0
Decks scanned:           0
Code heap literal scans: 0
( scratchpad ) [ test ] time
==== RUNNING TIME

2188 ms

==== GARBAGE COLLECTION

                         Nursery Aging Tenured
GC count:                0       0     0
Cumulative GC time (ms): 0       0     0
Longest GC pause (ms):   0       0     0
Average GC pause (ms):   0       0     0
Objects copied:          0       0     0
Bytes copied:            0       0     0

Total GC time (ms):      0
Cards scanned:           0
Decks scanned:           0
Code heap literal scans: 0
( scratchpad ) [ test ] time
==== RUNNING TIME

3422 ms

==== GARBAGE COLLECTION

                         Nursery Aging Tenured
GC count:                0       0     0
Cumulative GC time (ms): 0       0     0
Longest GC pause (ms):   0       0     0
Average GC pause (ms):   0       0     0
Objects copied:          0       0     0
Bytes copied:            0       0     0

Total GC time (ms):      0
Cards scanned:           0
Decks scanned:           0
Code heap literal scans: 0
( scratchpad ) 

Annotation: code

Author: prunedtree
Mode: factor
Date: Wed, 15 Oct 2008 18:43:11
Plain Text |
USING: kernel math hashtables arrays assocs sequences unicode.case 
       splitting prettyprint strings fry make ;
       
USING: kernel.private system sequences.private math.private ;
 
 
: do-stuff-once ( c a -- c a ) [ 0 swap nth-unsafe fixnum+fast { fixnum } declare ] keep ; inline

: do-stuff ( c a -- c ) 
   do-stuff-once 
   do-stuff-once 
   do-stuff-once 
   do-stuff-once 
   do-stuff-once 

   do-stuff-once 
   do-stuff-once 
   do-stuff-once 
   do-stuff-once 
   do-stuff-once 
   
   drop
   ; inline
  
: test2 ( -- foo ) 0 10 1000 1000 * * [ { fixnum } declare { { 1 } } first { array } declare do-stuff ] times ;
: test ( -- foo ) 0 10 1000 1000 * * [ { fixnum } declare { { 1 } } first do-stuff ] times ;
: count-ms ( quot -- ms ) millis [ call ] dip  millis swap - ;
: count ( -- call/ms ) [ test drop ] count-ms [ test2 drop ] count-ms - 10 1000 1000 * * swap / >float ;

New Annotation

Summary:
Author:
Mode:
Body: