PS: FWIW the difference you're seeing is quite similar to the difference 
between a native and wasm version of my 8-bit home computer emulators. For 
instance on my mid-2014 13 MBP, the C64 emulator's 
(https://floooh.github.io/tiny8bit/c64-ui.html) frame duration is between 4 
and 5ms in the native version, and between 6 and 7ms in the WASM version 
(in Chrome). The emulator code is fairly straightforward single-threaded 
portable C code with heavy bit twiddling on 64-bit integers.

On Thursday, 6 May 2021 at 16:12:51 UTC+2 Floh wrote:

> >  Right now, Emscripten only supports building 32 bit .wasm. Whereas, 
> .nexe is 64 bit.
>
> Note that the 32 in WASM32 is only about the pointer size, it has "proper" 
> 64-bit integers, only pointers (and thus the maximum heap size) are 32 
> bits. Theoretically this should even yield better performance than 64-bit 
> pointers.
>
> "long double" seem to be 128 bit floating point numbers, I don't think 
> that those have much relevance. Regular doubles (64-bits wide) are 
> supported natively by WASM.
>
> 30% performance difference doesn't sound all that surprising TBH and might 
> result from low level code generation differences between the WASM and 
> PNaCl LLVM backends (for instance differences in register allocation, or 
> calling conventions).
>
> On Tuesday, 4 May 2021 at 15:27:50 UTC+2 Amol Wagh wrote:
>
>>
>> Hello All,
>>
>> We have a chrome extension written in C++ and Javascript. Recently, 
>> changes are done to make use of WebAssembly module instead of NaCl module.
>> However, performance of WebAssembly found to be slower, on an avg by 30% 
>> and despite using `-O3`, than the NaCl's performance.
>> Emscripten compiler, v2.0.7, is used to prepare the .wasm. Whereas for 
>> .nexe, the C++ code is compiled using `pnacl-clang++` compiler. Later 
>> `pnacl-transalte` is used to generate the .nexe file. (x86_64 arch).
>>
>> OS and Compiler details are as follows. 
>> NaCl SDK having `Pepper 50`
>> Emscripten SDK version 2.0.7
>> Ubuntu 18.04.5 LTS
>> Chrome version 88.0.4324.182 (64-bit)
>> Processor : Intel® Core™ i5-5200U CPU @ 2.20GHz × 4
>>
>> My concern is -
>> Right now, Emscripten only supports building 32 bit .wasm. Whereas, .nexe 
>> is 64 bit. Are the two executable right candidates for the performance 
>> comparison?
>> There might be differences at several places.
>> e.g. As mentioned in the design spec 
>> <https://github.com/WebAssembly/design/blob/master/CAndC%2B%2B.md#platform-features>
>>  
>> of WebAssembly, `long double` are software-emulated.
>> Note that, I can build 32 bit nexe. However, can't use it in 64 bit 
>> Chrome. Following error occurs in that case.
>> NaCl module load failed: ELF file for wrong architecture.
>>
>> Regards,.
>> Amol
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/8e18785c-7044-4c80-92e2-998a22fdb8dfn%40googlegroups.com.

Reply via email to