Skip to content

Performance degradation when changing the "iovs_len" from 1 to 0 in "fd_write" calling #4451

@hungryzzz

Description

@hungryzzz

Symptom Description

Hi, I ran the good.wasm and bad.wasm attached in the code.zip, and surprisingly found that when I change the third parameter (iovs_len) of fd_write function call from 1 to 0, the execution time of Wamr became 4x longer. But intuitively, when copying a 0 length data to the fd, the execution time may be shorter.

The execution times in the WasmEdge (AOT) and Wamr(AOT) of both good.wasm and bad.wasm are as follows (measured by time tool):

For good.wasm:

  • WasmEdge: 0.62s
  • Wamr: 0.65s

For bad.wasm:

  • WasmEdge: 0.62s
  • Wamr: 2.56s

Repreduce Steps

# run on Wamr
wamrc -o $filename-wamr-aot.wasm $filename.wasm
iwasm $filename-wamr-aot.wasm > case.out

# run on WasmEdge
wasmedgec $filename.wasm $filename-wasmedge-aot.wasm
wasmedge $filename-wasmedge-aot.wasm > case.out

Environment

  • Wamr commit: ee056d8
  • Operating system: Linux ringzzz-OptiPlex-Micro-Plus-7010 6.5.0-18-generic
  • Architecture: Intel(R) Core(TM) i5-13500

code.zip

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