Skip to content

Instantly share code, notes, and snippets.

@timo
Created November 14, 2017 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/2fd64d7aab2f088a4b1ba75ddf6007ec to your computer and use it in GitHub Desktop.
Save timo/2fd64d7aab2f088a4b1ba75ddf6007ec to your computer and use it in GitHub Desktop.
timo@schmand ~/p/moarvm (master)> git diff
diff --git a/src/6model/reprs/MVMString.c b/src/6model/reprs/MVMString.c
index aa5d51a6a..4ac8c6459 100644
--- a/src/6model/reprs/MVMString.c
+++ b/src/6model/reprs/MVMString.c
@@ -57,8 +57,10 @@ static void gc_mark(MVMThreadContext *tc, MVMSTable *st, void *data, MVMGCWorkli
if (body->storage_type == MVM_STRING_STRAND) {
MVMStringStrand *strands = body->storage.strands;
MVMuint16 i;
- for (i = 0; i < body->num_strands; i++)
+ for (i = 0; i < body->num_strands; i++) {
+ fprintf(stderr, "%p %d %d %d\n", strands[i].blob_string, strands[i].blob_string->body.num_graphs, strands[i].start, strands[i].end);
MVM_gc_worklist_add(tc, worklist, &(strands[i].blob_string));
+ }
}
}
timo@schmand ~/p/moarvm (master)> cat /tmp/tally_string_strands.p6
my int8 @chars;
my str $current;
for lines().sort {
my @pieces = .words;
my str $ptr = @pieces.shift;
my int $len = @pieces.shift.Int;
my int $start = @pieces.shift.Int;
my int $end = @pieces.shift.Int;
sub summarize {
if $current {
my $usage = [+] @chars;
if @chars != $usage {
say "string $current usage: { $usage * 100 / @chars }% - { @chars - $usage } wasted, { +@chars } graphs";
}
}
$current = $ptr;
@chars = Empty;
}
if $ptr ne $current {
summarize
}
LAST summarize;
for $start..$end {
@chars[$_] = 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment