Is the use of u8 faster then usize for webassembly target?

The indexes of vectors are usize.
So a lot of the code becomes usize.
Usize are 32 or 64 bit depends of the system.
What is the usize for webassemly?
U8 is much smaller than usize. Does it work faster because of that? And can it be used for indexes?

If you plan on encoded integers, they use the variable-length LEB128 format. However all integer types are either i32 or i64 as those are the only types defined in Webassembly, so for function signatures (and such) there is no benefit of U8 over usize.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.