How to test performance of WASM vs Native?

What would be the best way to go about testing performance of a piece of code written in Rust, C++ compiled to WebAssembly and then testing the same code natively?

To give some context, what I want to do is take a piece of code in one of the languages, run it on a Windows machine, then take that piece of code, compile it to WebAssembly and run it in a browser. And then compare the performance between the two - how fast did the code execute, how much RAM, CPU, GPU the computer ate etc.