Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

Typed objects in JavaScript

Published: 14 October 2014 Publication History

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.

References

[1]
Are we fast yet? http://arewefastyet.com.
[2]
ctypes-A foreign function interface for Python. http://docs.python.org/2/library/ctypes.html.
[3]
Draft Specification for ES.next (Ecma-262 Edition 6). http://wiki.ecmascript.org/.
[4]
Java Native Access. https://github.com/twall/jna.
[5]
JSctypes. https://wiki.mozilla.org/JSctypes.
[6]
LibFFI. https://sourceware.org/libffi/.
[7]
Mandreel. http://www.mandreel.org.
[8]
The Python Data Model, Section 3.4.2.4. http://docs.python.org/2/reference/datamodel.html.
[9]
Alon Zakai et al. Emscripten. http://www.emscripten.org.
[10]
J. Dolby. Automatic Inline Allocation of Objects. In Programming Language Design and Implementation, PLDI '97, pages 7--17, New York, NY, USA, 1997. ACM. ISBN 0-89791-907-6.
[11]
B. Hackett and S.-y. Guo. Fast and Precise Hybrid Type Inference for JavaScript. In Programming Language Design and Implementation, PLDI '12, pages 239--250, New York, NY, USA, 2012. ACM. ISBN 978-1-4503-1205-9.
[12]
T. Jim, J. G. Morrisett, D. Grossman, M. W. Hicks, J. Cheney, and Y. Wang. Cyclone: A Safe Dialect of C. In USENIX Annual Technical Conference, ATEC '02, pages 275--288, Berkeley, CA, USA, 2002. USENIX Association. ISBN 1-880446-00-6.
[13]
A. W. Keep and R. K. Dybvig. Ftypes: Structured foreign types. In Scheme 2011: Workshop on Scheme and Functional Programming, pages 57--65, 2011.
[14]
The Khronos Group. Typed Array Specification v1.0. https://www.khronos.org/registry/typedarray/specs/1.0/, February 2011.
[15]
Veldema, Ronald and Jacobs, Ceriel J. H. and Hofman, Rutger F. H. and Bal, Henri E. Object Combining: A New Aggressive Optimization for Object Intensive Programs: Research Articles. Concurr. Comput. : Pract. Exper., 17(5-6):439--464, Apr. 2005. ISSN 1532-0626.
[16]
C. Wimmer and H. Mössenböck. Automatic Feedback-directed Object Inlining in the Java Hotspot™ Virtual Machine. In Virtual Execution Environments, VEE '07, pages 12--21, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-630-1.

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 50, Issue 2
DLS '14
February 2015
146 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2775052
  • Editor:
  • Andy Gill
Issue’s Table of Contents
  • cover image ACM Conferences
    DLS '14: Proceedings of the 10th ACM Symposium on Dynamic languages
    October 2014
    160 pages
    ISBN:9781450332118
    DOI:10.1145/2661088
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 14 October 2014
Published in SIGPLAN Volume 50, Issue 2

Check for updates

Author Tags

  1. javascript
  2. typed arrays
  3. typed objects

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)11
  • Downloads (Last 6 weeks)0
Reflects downloads up to 13 Nov 2024

Other Metrics

Citations

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media