Permalink
Browse files

Compare CPython and OPy opcode histograms.

  • Loading branch information...
Andy Chu
Andy Chu committed Mar 13, 2018
1 parent 50ebc28 commit f8bc99fcfc698d8989e3680d2bee33223a40991d
Showing with 19 additions and 0 deletions.
  1. +16 −0 opy/count.sh
  2. +3 −0 opy/misc/inspect_pyc.py
View
@@ -44,4 +44,20 @@ all() {
echo
}
# Hm there are 119 total opcodes, but these files only use 38, 37, 36, and 23.
# Interesting.
# With opy: 39, 38, 35, 24. Oh so there's 1 more or one less. Interesting!
# TODO: diff them.
opcodes() {
for prefix in '' _tmp/oil-with-opy/; do
for pyc in \
${prefix}osh/{cmd,bool,word,arith}_parse.pyc; do
echo $pyc
bin/opyc dis $pyc | tail -n 1
done
done
}
"$@"
View
@@ -227,3 +227,6 @@ def Report(self):
print('Opcode Histogram:')
for op, count in self.op_counts.most_common():
print('%5d %s' % (count, dis.opname[op]))
print()
print('%d unique opcodes' % len(self.op_counts))

0 comments on commit f8bc99f

Please sign in to comment.