Use typed arrays.
________________________________
From: Zexx<mailto:zex2...@gmail.com>
Sent: ‎2014-‎10-‎30 20:16
To: es-discuss@mozilla.org<mailto:es-discuss@mozilla.org>
Subject: Types

Hello,

Isn't optional typing (similar to TypeScript) a good thing?

Let's say I want to do some image processing. And images can be really
huge nowadays. If I allocate an array of dynamic variables, that array
may be 10x larger than if it was an array of bytes. And I need bytes to
store and process R,G,B,A values separately. So, the array itself could
have a descriptor of the type, and each member of the array can then
contain only the value.

As things are now, a 32 megapixel image in ES would allocate 32,000,000
x 4 = 128 million dynamic variables. If each variant takes up 8 bytes,
that's 1 GB per image. Let's say I have two source images, one mask and
one output. That's 4 gigabytes just in images, not counting the
application, libraries, web browser, other running apps, OS, drivers, etc.

That's a waste of resources. Native apps would need only about 0.5 GB
for all 4 source images, so it would run on a wide variety of devices as
opposed to the ES variant. And thus the author would sell more copies
and earn more money. Instead of getting comments like "Why did you made
this crappy slow app. Learn to program. Competition is much faster".

If ES is to become a proper, truly versatile language, shouldn't
programmer be allowed to use it's knowledge of the app design to
optimize resources?

Best regards,

Zex

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to