Skip to content

The reference interpreter became up to 20 times slower after a87fffc #1979

@bashor

Description

@bashor

While experimenting with the reference interpreter on binaries produced by Kotlin, I noticed a huge performance degradation.
It seems it is due to some changes introduced in a87fffc.

To reproduce it, please run a wasm file index.wasm.zip in reference interpreter with the following command:

'wasm' index.wasm -t -e '(module instance) (invoke "_initialize") (invoke "runBoxTest")'

Here are some runs with different versions:

a87fffc

$ time '_build/a8/wasm.exe' index.wasm -t -e '(module instance) (invoke "_initialize") (invoke "runBoxTest")'
-- Running ("(input \"index.wasm\")")...
-- Parsing...
-- Running...
-- Loading (index.wasm)...
-- Decoding...
-- Running...
-- Decoding...
-- Checking...
-- Running ("(module instance) (invoke \"_initialize\") (invoke \"runBoxTest\")")...
-- Parsing...
-- Running...
-- Initializing...
-- Invoking function "_initialize"...
-- Invoking function "runBoxTest"...
1 : [i32]
'a8/wasm.exe'  -t -e   12.65s user 1.27s system 97% cpu 14.212 total

d0eee4a

$ time '_build/d0/wasm.exe' index.wasm -t -e '(module instance) (invoke "_initialize") (invoke "runBoxTest")'
-- Running ("(input \"index.wasm\")")...
-- Parsing...
-- Running...
-- Loading (index.wasm)...
-- Decoding...
-- Running...
-- Decoding...
-- Checking...
-- Running ("(module instance) (invoke \"_initialize\") (invoke \"runBoxTest\")")...
-- Parsing...
-- Running...
-- Initializing...
-- Invoking function "_initialize"...
-- Invoking function "runBoxTest"...
1 : [i32]
'_build/d0/wasm.exe'  -t -e   0.65s user 0.02s system 73% cpu 0.919 total

d79e5c8

$ time '_build/d7/wasm.exe' index.wasm -t -e '(module instance) (invoke "_initialize") (invoke "runBoxTest")'
-- Running ("(input \"index.wasm\")")...
-- Parsing...
-- Running...
-- Loading (index.wasm)...
-- Decoding...
-- Running...
-- Decoding...
-- Checking...
-- Running ("(module instance) (invoke \"_initialize\") (invoke \"runBoxTest\")")...
-- Parsing...
-- Running...
-- Initializing...
-- Invoking function "_initialize"...
-- Invoking function "runBoxTest"...
1 : [i32]
'_build/d7/wasm.exe'  -t -e   0.65s user 0.02s system 78% cpu 0.860 total

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions