Typed objects in JavaScript

Nicholas D. Matsakis, David Herman, Dmitry Lomov
{"title":"Typed objects in JavaScript","authors":"Nicholas D. Matsakis, David Herman, Dmitry Lomov","doi":"10.1145/2661088.2661095","DOIUrl":null,"url":null,"abstract":"JavaScript's typed arrays have proven to be a crucial API for many JS applications, particularly those working with large amounts of data or emulating other languages. Unfortunately, the current typed array API offers no means of abstraction. Programmers are supplied with a simple byte buffer that can be viewed as an array of integers or floats, but nothing more. This paper presents a generalization of the typed arrays API entitled typed objects. The typed objects API is slated for inclusion in the upcoming ES7 standard. The API gives users the ability to define named types, making typed arrays much easier to work with. In particular, it is often trivial to replace uses of existing JavaScript objects with typed objects, resulting in better memory consumption and more predictable performance. The advantages of the typed object specification go beyond convenience, however. By supporting opacity---that is, the ability to deny access to the raw bytes of a typed object---the new typed object specification makes it possible to store objects as well as scalar data and also enables more optimization by JIT compilers.","PeriodicalId":244838,"journal":{"name":"Proceedings of the 10th ACM Symposium on Dynamic languages","volume":"1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2014-10-14","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 10th ACM Symposium on Dynamic languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2661088.2661095","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2

Abstract

JavaScript's typed arrays have proven to be a crucial API for many JS applications, particularly those working with large amounts of data or emulating other languages. Unfortunately, the current typed array API offers no means of abstraction. Programmers are supplied with a simple byte buffer that can be viewed as an array of integers or floats, but nothing more. This paper presents a generalization of the typed arrays API entitled typed objects. The typed objects API is slated for inclusion in the upcoming ES7 standard. The API gives users the ability to define named types, making typed arrays much easier to work with. In particular, it is often trivial to replace uses of existing JavaScript objects with typed objects, resulting in better memory consumption and more predictable performance. The advantages of the typed object specification go beyond convenience, however. By supporting opacity---that is, the ability to deny access to the raw bytes of a typed object---the new typed object specification makes it possible to store objects as well as scalar data and also enables more optimization by JIT compilers.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
JavaScript中的类型化对象
JavaScript的类型化数组已被证明是许多JS应用程序的关键API,特别是那些处理大量数据或模拟其他语言的应用程序。不幸的是,当前的类型化数组API没有提供抽象的方法。为程序员提供了一个简单的字节缓冲区,可以将其视为整数或浮点数的数组,但仅此而已。本文提出了类型化数组API的一种概括,称为类型化对象。类型化对象API计划包含在即将到来的ES7标准中。该API使用户能够定义命名类型,从而使类型化数组更易于使用。特别是,用类型化对象替换现有JavaScript对象的使用通常是微不足道的,这会导致更好的内存消耗和更可预测的性能。然而,类型化对象规范的优点不仅仅是方便。通过支持不透明性(即拒绝访问类型化对象的原始字节的能力),新的类型化对象规范使得存储对象和标量数据成为可能,并且还允许JIT编译器进行更多优化。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Proceedings of the 10th ACM Symposium on Dynamic languages Why do we know so little about programming languages, and what would have happened if we had known more? Dynamic page sharing optimization for the R language Design and evaluation of gradual typing for python ACDC-JS: explorative benchmarking of javascript memory management
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1