core :: Sys :: show_string_stats
private fun show_string_stats do
print """
Usage of Strings:
Allocations, by type:
"""
print "\t-UnicodeFlatString = {uniflatstr_allocations}"
print "\t-ASCIIFlatString = {asciiflatstr_allocations}"
print "\t-FlatBuffer = {flatbuf_allocations}"
print "\t-Concat = {concat_allocations}"
print ""
print "Calls to length, by type:"
for k, v in length_calls do
printn "\t{k} = {v}"
if k == "UnicodeFlatString" then printn " (cache misses {length_cache_miss[k]}, {div(length_cache_miss[k] * 100, v)}%)"
printn "\n"
end
print "Indexed accesses, by type:"
for k, v in index_call do
printn "\t{k} = {v}"
if k == "Concat" then printn " (cache misses {concat_cache_miss}, {div(concat_cache_miss * 100, v)}%)"
printn "\n"
end
print "Calls to byte_length for each type:"
for k, v in byte_length_call do
print "\t{k} = {v}"
end
print "Calls to position for each type:"
for k, v in position_call do
print "\t{k} = {v}"
end
print "Calls to bytepos for each type:"
for k, v in bytepos_call do
print "\t{k} = {v}"
end
print "Calls to first_byte on FlatString {first_byte_call}"
print "Calls to last_byte on FlatString {last_byte_call}"
print "Length of travel for index distribution:"
index_len.print_content
print "Byte length of the FlatStrings created:"
str_byte_length.print_content
end
lib/text_stat/text_stat.nit:73,2--120,4