bug: Unnecessary copy of full module when loading
q82419 opened this issue · comments
Summary
After applying the loader of compoent model (#3036), the loader load create a unique ptr and load from file / bytes.
https://github.com/WasmEdge/WasmEdge/blob/master/lib/loader/loader.cpp#L108
But this function return the raw pointer from the unique ptr, which causes the copy of full module.
https://github.com/WasmEdge/WasmEdge/blob/master/lib/loader/loader.cpp#L126
Even though the function is safe (the module is copied into the returned variant container and then the unique ptr destroyed), but this will cause the overhead.
Current State
No response
Expected State
Return the unique_ptr directly.
This should be fixed before the 0.14.0 release.
Reproduction steps
None.
Screenshots
No response
Any logs you want to share for showing the specific issue
No response
Components
C SDK
WasmEdge Version or Commit you used
master
Operating system information
Ubuntu 20.04
Hardware Architecture
x86_64
Compiler flags and options
No response