Permalink
Browse files
Compare CPython and OPy opcode histograms.
- Loading branch information...
Showing
with
19 additions
and
0 deletions.
-
+16
−0
opy/count.sh
-
+3
−0
opy/misc/inspect_pyc.py
|
|
@@ -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
|
|
|
}
|
|
|
|
|
|
"$@"
|
|
|
@@ -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