I wish new platforms would embrace 64 bit as the default. C and C++ for all common platforms use 32 bit literals and prefer 32 bit operations (char * short => int). Rust made a similar mistake. Java arrays use 32 bit subscripts, etc... I don't have a single computer (including my phone) using 32 bit pointers, but integers are stuck in the late 80s. (We already had 64 bit DEC alphas in the early 90s) For a web page, 4…
Up to 4GB of Memory in WebAssembly
21–30 of 86 posts
Re: Up to 4GB of Memory in WebAssembly
#22Amazing that they have a dark mode detection on that website.
Re: Up to 4GB of Memory in WebAssembly
#23Earlier quoted context omitted.
I'm pretty sure rust uses usize, which is 64 bits on modern architectures.
Rust literals will infer their type from context if possible. Otherwise I believe the default is i32. There are also literal suffixes. So you can 999u64 of 999.02f64 if you want.
Re: Up to 4GB of Memory in WebAssembly
#24Re: Up to 4GB of Memory in WebAssembly
#25Earlier quoted context omitted.
Rust literals will infer their type from context if possible. Otherwise I believe the default is i32. There are also literal suffixes. So you can 999u64 of 999.02f64 if you want.
literals, yes, but he's talking specifically about indexing into arrays by my understanding
#![feature(type_name_of_val)]
fn main() {
let v = vec![1, 2, 3];
let x = 1;
let y = 1;
v[x];
dbg!(std::any::type_name_of_val(&x));
dbg!(std::any::type_name_of_val(&y));
}
gives [src/main.rs:11] std::any::type_name_of_val(&x) = "usize"
[src/main.rs:12] std::any::type_name_of_val(&y) = "i32"
https://play.rust-lang.org/?version=nightly&mode=debug&editi...Re: Up to 4GB of Memory in WebAssembly
#26Re: Up to 4GB of Memory in WebAssembly
#27Earlier quoted context omitted.
As is mentioned in the article, u64 was used to future proof for wasm's upcoming memory64 type: https://github.com/WebAssembly/memory64/blob/master/proposal...
Yeah, so what are they going to do when they then claim to need to to represent the length 2^64?
Re: Up to 4GB of Memory in WebAssembly
#28I wish new platforms would embrace 64 bit as the default. C and C++ for all common platforms use 32 bit literals and prefer 32 bit operations (char * short => int). Rust made a similar mistake. Java arrays use 32 bit subscripts, etc... I don't have a single computer (including my phone) using 32 bit pointers, but integers are stuck in the late 80s. (We already had 64 bit DEC alphas in the early 90s) For a web page, 4…
Re: Up to 4GB of Memory in WebAssembly
#29I wish new platforms would embrace 64 bit as the default. C and C++ for all common platforms use 32 bit literals and prefer 32 bit operations (char * short => int). Rust made a similar mistake. Java arrays use 32 bit subscripts, etc... I don't have a single computer (including my phone) using 32 bit pointers, but integers are stuck in the late 80s. (We already had 64 bit DEC alphas in the early 90s) For a web page, 4…
If you're seriously using more than 4gb in a web page... I wouldn't mind a non-default wasm64 format. You should also be considering shipping a native app at that point, wasm is not free in terms of performance.
Re: Up to 4GB of Memory in WebAssembly
#30I wish new platforms would embrace 64 bit as the default. C and C++ for all common platforms use 32 bit literals and prefer 32 bit operations (char * short => int). Rust made a similar mistake. Java arrays use 32 bit subscripts, etc... I don't have a single computer (including my phone) using 32 bit pointers, but integers are stuck in the late 80s. (We already had 64 bit DEC alphas in the early 90s) For a web page, 4…
I, on the other hand, wish everyone would embrace 32 bit by default. Doubling the size of every index, integer, etc comes at significant memory cost for next to no benefit. Increasing the amount of memory used directly impacts performance considering how slow memory is and how important it is to keep commonly used items in cache. If you're seriously using more than 4gb in a web page... I wouldn't mind a non-default w…
The overwhelming majority of GUI program data is composed of images, textures, sounds, videos, 3D models, text, etc.
I would bet that less than 5% of the memory required to host a popular web page (facebook, amazon, etc.) is dedicated to pointers, array indices, etc.