Skip to content

Commit

Permalink
[benchmarks] Align dumb_alloc requests to 8 bytes.
Browse files Browse the repository at this point in the history
And improve the Id histogram.
  • Loading branch information
Andy Chu committed Dec 12, 2019
1 parent fab6496 commit 125a27a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions core/ui.py
Expand Up @@ -254,11 +254,10 @@ def PrintAst(nodes, opts):
if 0:
from _devbuild.gen.id_kind_asdl import Id_str
from frontend.lexer import ID_HIST
total = 0
for id_, count in ID_HIST.most_common():
for id_, count in ID_HIST.most_common(10):
print('%8d %s' % (count, Id_str(id_)))
total += count
print()
total = sum(ID_HIST.values())
print('%8d total tokens returned' % total)

else: # text output
Expand Down
7 changes: 4 additions & 3 deletions cpp/dumb_alloc.cc
Expand Up @@ -11,10 +11,11 @@ int gMemPos = 0;
int gNumNew = 0;
int gNumDelete = 0;

// https://stackoverflow.com/questions/2022179/c-quick-calculation-of-next-multiple-of-4
// Align returned pointers to the worst case of 8 bytes (64-bit pointers)
inline size_t aligned(size_t n) {
//return (n + 7) & ~7;
return (n + 15) & ~15;
// https://stackoverflow.com/questions/2022179/c-quick-calculation-of-next-multiple-of-4
return (n + 7) & ~7;
//return (n + 15) & ~15;
}

// This global interface is silly ...
Expand Down

0 comments on commit 125a27a

Please sign in to comment.