Ticket #1138 (closed todo: fixed)
Create a 'vivify' opcode
| Reported by: | Austin_Hastings | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Version: | 1.7.0 |
| Severity: | medium | Keywords: | |
| Cc: | Language: | ||
| Patch status: | Platform: |
Description
PCT generates a lot of code that looks like:
find_lex $P99, '$var'
unless_null $P99, vivify_22
$P99 = new 'Undef'
vivify_22:
In kakapo.pir, a library of 21872 lines (wc-l) of NQP generated pir, there were 1381 occurrences of this pattern. (Grep ", vivify_" | wc -l)
This is 6.3% of the total file size, including infrastructure. It's surely a larger fraction of the "real" code. (In fact, that's one of three lines the pattern uses. So the pattern is actually something like 19% of the total lines in the file.)
Converting these two opcodes:
unless-null P, IC
new P, SC
into 1 opcode:
vivify P, SC
would reduce the pir size by that 6%, since it eliminates one of the lines entirely. Per a conversation with chromatic this evening, we expect about a 2-3% reduction is pbc size (pir lines != opcode words) and a corresponding 2-3% increase in execution speed.
