skip to main content
research-article

Typed objects in JavaScript

Published:14 October 2014Publication History
Skip Abstract Section

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.Google ScholarGoogle Scholar
  2. ctypes-A foreign function interface for Python. http://docs.python.org/2/library/ctypes.html.Google ScholarGoogle Scholar
  3. Draft Specification for ES.next (Ecma-262 Edition 6). http://wiki.ecmascript.org/.Google ScholarGoogle Scholar
  4. Java Native Access. https://github.com/twall/jna.Google ScholarGoogle Scholar
  5. JSctypes. https://wiki.mozilla.org/JSctypes.Google ScholarGoogle Scholar
  6. LibFFI. https://sourceware.org/libffi/.Google ScholarGoogle Scholar
  7. Mandreel. http://www.mandreel.org.Google ScholarGoogle Scholar
  8. The Python Data Model, Section 3.4.2.4. http://docs.python.org/2/reference/datamodel.html.Google ScholarGoogle Scholar
  9. Alon Zakai et al. Emscripten. http://www.emscripten.org.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  14. The Khronos Group. Typed Array Specification v1.0. https://www.khronos.org/registry/typedarray/specs/1.0/, February 2011.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Typed objects in JavaScript

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • 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

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 14 October 2014

      Check for updates

      Qualifiers

      • research-article
    • Article Metrics

      • Downloads (Last 12 months)29
      • Downloads (Last 6 weeks)2

      Other Metrics

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!