Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: indirect call benchmark #632

Merged
merged 1 commit into from
Nov 3, 2020
Merged

bench: indirect call benchmark #632

merged 1 commit into from
Nov 3, 2020

Conversation

axic
Copy link
Member

@axic axic commented Nov 3, 2020

It gets inefficiently compiled to exactly what we want to test:

  (func $fnv1 (type $t0) (param $p0 i64) (param $p1 i64) (result i64)
    get_local $p1
    get_local $p0
    i64.xor
    i64.const 1099511628211
    i64.mul)
  (func $threeab (type $t0) (param $p0 i64) (param $p1 i64) (result i64)
    get_local $p0
    i64.const 3
    i64.mul
    get_local $p1
    i64.add)
  (func $icall (export "icall") (type $t2) (param $p0 i32) (result i32)
    (local $l0 i64) (local $l1 i32)
    block $B0
      get_local $p0
      i32.eqz
      br_if $B0
      i64.const -3750763034362895579
      set_local $l0
      i32.const 0
      set_local $l1
      loop $L1
        get_local $l0
        i64.const 1311768467294899695
        get_local $l1
        i32.const 1
        i32.and
        i32.const 2
        i32.shl
        i32.const 1024
        i32.add
        i32.load
        call_indirect (type $t0)
        set_local $l0
        get_local $p0
        get_local $l1
        i32.const 1
        i32.add
        tee_local $l1
        i32.ne
        br_if $L1
      end
      get_local $l0
      i32.wrap/i64
      return
    end
    i32.const -2078137563)

@axic
Copy link
Member Author

axic commented Nov 3, 2020

Quick run:
master:

fizzy/execute/micro/icall_hash/1000_steps         335 us          330 us         2255
 wabt/execute/micro/icall_hash/1000_steps         356 us          353 us         2015
wasm3/execute/micro/icall_hash/1000_steps        37.9 us         37.6 us        18619

#616:

fizzy/execute/micro/icall_hash/1000_steps         131 us          121 us         5731
 wabt/execute/micro/icall_hash/1000_steps         342 us          340 us         2080
wasm3/execute/micro/icall_hash/1000_steps        38.2 us         37.6 us        19328

@codecov
Copy link

codecov bot commented Nov 3, 2020

Codecov Report

Merging #632 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #632   +/-   ##
=======================================
  Coverage   98.33%   98.33%           
=======================================
  Files          67       67           
  Lines        9535     9535           
=======================================
  Hits         9376     9376           
  Misses        159      159           

@chfast chfast merged commit cbbc0b8 into master Nov 3, 2020
@chfast chfast deleted the bench-icall branch November 3, 2020 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants