Some people have mentioned that memcpy and memmove functions are hot
when profiling some WebAssembly benchmarks. Some examples:
I've been looking at perf profiles for wasm unity benchmark a bit recently and see that some
| ;; Convert this to add.wasm by running: | |
| ;; | |
| ;; wat2wasm add.wat -o add.wasm | |
| ;; | |
| (module | |
| (func (export "add") (param i32 i32) (result i32) | |
| get_local 0 | |
| get_local 1 | |
| i32.add)) |
| (module | |
| (import "env" "memory" (memory 1)) | |
| (func $memcpy (export "memcpy") (param i32 i32 i32) (result i32) | |
| (local i32) | |
| (block (result i32) ;; label = @1 | |
| (set_local 3 | |
| (get_local 0)) | |
| (if ;; label = @3 | |
| (i32.eq | |
| (i32.and |
Some people have mentioned that memcpy and memmove functions are hot
when profiling some WebAssembly benchmarks. Some examples:
I've been looking at perf profiles for wasm unity benchmark a bit recently and see that some
| #!/usr/bin/env python | |
| import math | |
| import os | |
| import sys | |
| def calculate(scx, expected_cycles, sprites): | |
| buckets = [0] * (((168 + scx + 7) // 8)) | |
| scx &= 7 | |
| total = scx | |
| if 0 in sprites: |
| {"modules": [ | |
| {"filename": "switch-spec.0.wasm", "commands": [ | |
| {"type": "assert_return", "name": "$assert_return_0", "file": "third_party/testsuite/switch.wast", "line": 125}, | |
| {"type": "assert_return", "name": "$assert_return_1", "file": "third_party/testsuite/switch.wast", "line": 126}, | |
| {"type": "assert_return", "name": "$assert_return_2", "file": "third_party/testsuite/switch.wast", "line": 127}, | |
| {"type": "assert_return", "name": "$assert_return_3", "file": "third_party/testsuite/switch.wast", "line": 128}, | |
| {"type": "assert_return", "name": "$assert_return_4", "file": "third_party/testsuite/switch.wast", "line": 129}, | |
| {"type": "assert_return", "name": "$assert_return_5", "file": "third_party/testsuite/switch.wast", "line": 130}, | |
| {"type": "assert_return", "name": "$assert_return_6", "file": "third_party/testsuite/switch.wast", "line": 131}, | |
| {"type": "assert_return", "name": "$assert_return_7", "file": "third_party/testsuite/switch.wast", "line": 132}, |
| doing stuff... | |
| doing stuff... | |
| chunk 0: used: 50000 size: 65536 | |
| chunk 1: used: 37020 size: 65536 | |
| chunk 2: used: 51000 size: 65536 | |
| chunk 3: used: 44000 size: 65536 | |
| chunk 4: used: 58000 size: 65536 | |
| chunk 5: used: 63000 size: 65536 | |
| chunk 6: used: 41000 size: 65536 | |
| chunk 7: used: 56000 size: 65536 |
| #include <assert.h> | |
| #include <stddef.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <sys/time.h> | |
| #include "benchmark/benchmark.h" |
| -- See original here http://www.a1k0n.net/2006/09/15/obfuscated-c-donut.html | |
| A=0 B=0 z={}b= | |
| {}E={32,46,44,45,126, | |
| 58,59,61,33,42,35,36,64}S | |
| =math.sin C=math.cos F=math. | |
| floor I=io.write T=string.char W=60 | |
| P=print H=25 P("\\x1b[2J")for w=1,240 | |
| do for o=0,W*H do b[o]=1 z[o]=0 end e= | |
| S(A)g=C(A)m=C(B)n=S(B)for j=0,6.28,.09 |