Live data from Hacker News

Up to 4GB of Memory in WebAssembly

v8.dev

21–30 of 86 posts

Re: Up to 4GB of Memory in WebAssembly

#21
post #16

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…

Do you happen to have an Apple Watch?

Re: Up to 4GB of Memory in WebAssembly

#23

Earlier 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.

literals, yes, but he's talking specifically about indexing into arrays by my understanding

Re: Up to 4GB of Memory in WebAssembly

#24
post #7

Earlier quoted context omitted.

You can do that in CSS now. I've noticed surprisingly many sites adjusting when I started using a Windows machine and set my system-wide preference to dark mode.

Prolly cause the devs themselves use it

Yup I try to convert every product I develop lol

Re: Up to 4GB of Memory in WebAssembly

#25

Earlier 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

Yes, so, the situation is:

    #![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

#26
post #10

So, will we need to have 4GB of ram to run Javascripts now? :)

The title refers to web assembly memory limit. However, it’s mentioned javascript now supports up to 16 million terabytes of memory (equivalent to 4 jira tabs).

Came here to see this, was not disappointed.

Re: Up to 4GB of Memory in WebAssembly

#27
post #14

Earlier 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?

If you have 2^64 objects, you have a bigger problem.

Re: Up to 4GB of Memory in WebAssembly

#28
post #16

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…

Using 32-bit pointers can save a lot of memory in pointer-heavy data. Saving memory matters on mobile devices.

Re: Up to 4GB of Memory in WebAssembly

#29
post #16

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…

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 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

#30
post #29
post #16

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…

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…

> Doubling the size of every index, integer, etc comes at significant memory cost for next to no benefit.

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.

Post reply on HN