Skip to content

Bytecode binary format gets decoded on every function call? #31

Description

@icefoxen

I was noodling around in the code and discovered that, as far as I can tell, the bytecode interpreter decodes the binary instructions to Instruction when a function is called, not when the bytecode is loaded. This means that every time a function is called it has to re-decode all the instructions. On a benchmark program (fib implemented the dumb way) on Linux AMD64, it spent about 15% of the time in ketos::bytecode::Instruction::decode(), the highest of any function as recorded by perf.

I haven't successfully made it decode the bytecode and store the result only once yet, but once I manage I'll post comparative benchmarks here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions