2023 Volume 40 Issue 4 Pages 4_54-4_66
Dynamically typed languages, such as JavaScript, require more memory compared to statically typed languages because they determine data types at runtime and need to store data type information in memory along with the values. However, even in dynamically typed languages, collections such as arrays are often used to store values of the same type. To reduce memory usage, we implemented a technique called “storage strategy” on arrays that store only values of the same type. This technique involves holding the type information within the collection itself rather than storing it separately. We introduced smaller data types such as 1-byte integers for the array data types to further reduce memory usage. We implemented our proposal in a JavaScript virtual machine specifically designed for embedded systems and evaluated its performance.