When looking at the output of "strings factor.image", I noticed that
a few strings seem to be repeated a lot of time. I saved the result
into "factor.strings" and ran:

: count-into ( seq hash -- )
  [ [ [ drop 0 ] cache 1+ ] 2keep set-at ] curry each ;

: count ( seq -- hash ) H{ } clone tuck count-into ; 

: items ( hash -- seq ) [ { } 2sequence ] { } assoc>map ;

: sorted ( seq -- sortedseq ) [ second swap second <=> ] sort ;

: analyze ( seq n -- seq ) >r count items sorted r> head ; 

"factor.strings" <file-reader> lines 10 analyze .

It looks like those strings are present *a lot* of times in the image:

{
    { "stack_chain" 1137 }
    { "cards_offset" 855 }
    { "alien_offset" 564 }
    { "nursery" 509 }
    { "simple_gc" 508 }
    { "to_cell" 416 }
    { "to_fixnum" 390 }
    { "PGe G" 150 }
    { "box_signed_4" 140 }
    { "to_double" 139 }
}

Wouldn't it be better to intern strings as is done in Java class
files?  Strings are immutable (as long as they are not passed to a
foreign function).

  Sam
-- 
Samuel Tardieu -- [EMAIL PROTECTED] -- http://www.rfc1149.net/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to