The op_code() function in op_lib_t does look up an op_info_table entry 
by the op's full_name. To accomplish this, the current implementation 
builds via ops2c.pl basically a static hash table, which get's appended 
to core_ops.c and core_ops_prederef.c.

My proposal is: build a hash table at runtime on the first invocation of 
op_code() (which parrot doesn't do).

This would currently:
- save ~ 2*1500 lines of genderated source code
- save - according to nm 2*13 KB per static executable
- save 50 % lookup time because of fully hashing the opcodes full_name
- have no influence on parrot itself, because parrot doesn't use this 
function.

testing op_code for 889 ops 10000 times:
current:  real    0m8.674s
mine:     real    0m3.827s

The current only users of op_code() are the debugger (PDB_eval), pxs.c 
and imcc.

If no one has objections I'll send a patch.

leo

Reply via email to