Abstract
A key programming concept in the world of internet-of-things (IoT) is event-driven computation where events occurred in the ‘things’ are handled by their corresponding event handlers. JavaScript is particularly useful for this computational model due to its properties having event handlers simply programmable. Turning this model into a reality requires a compact, yet powerful JavaScript engine, which can be possibly working on a system equipped with scarce memory and limited CPU of the IoT devices. Although existing JavaScript engines widely being used in web browsers are powerful enough, they require a plenty amount of both static and runtime memory, which cannot fit in the small IoT devices. To handle this space issue, three small footprint JavaScript engines have been proposed previously: Espruino (http://www.espruino.com/), Quad-wheel (https://code.google.com/p/quad-wheel/), and Duktape (http://duktape.org/). This paper compares the three JavaScript engines by evaluating their binary size, runtime memory, and performance, as well as their compatibility of JavaScript tests. It has been found that, out of them, only Duktape correctly supports JavaScript features described in the current standard, yet with mediocre performance and memory requirement. This paper converts Duktape into a better performing one (which we call Duktape+) by applying six optimisations, including efficient property updates and lazy creation of built-in objects. Those optimisations result in as much as 30 % reduction of runtime memory usage and 30 % improvement of performance, with only 2 % increase of its binary size.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
L. Atzori, A. Iera, G. Morabito, The internet of things: A survey, International Journal of Computer and Telecommunications Networking, 54, 2787–2805 (2010)
S. Tilkov, S. Vinoski, Node.js: Using JavaScript to build high-performance network programs. IEEE Internet Comput. 14(6), 80–83 (2010)
T.-M. Grønli, G. Ghinea, M. Younas, A lightweight architecture for the Web-of-Things. Mobile Web Information Systems (Springer, Berlin and Heidelberg, 2013), pp. 248–259
M. Kovatsch, M. Lanter, S. Duquennoy, Actinium: A restful runtime container for scriptable internet of things applications. 2012 3rd international conference on the internet of things (IOT), IEEE, 2012.
L. Tong et~al., Interactive surface composition based on arduino in multi-display environments. Proceedings of the ninth ACM international conference on interactive tabletops and surfaces, ACM, 2014.
ECMAScript, ECMA International, European Computer Manufacturers Association, ECMAScript Language Specification 5.1 Edition (2011), Accessible at http://www.ecma-international.org/ecma-262/5.1/Ecma-262.pdf
R. Jones, R.D. Lins, Garbage Collection: Algorithms for Automatic Dynamic Memory Management (Wiley, New York, 1996)
J.R. Bell, Threaded code. Commun. ACM 16(6) (1973)
C. Wootton, Beginning Samsung ARTIK. Apress (2016)
Acknowledgments
This research was supported by the Ministry of Trade, Industry and Energy (MOTIE) through the Electronics and Telecommunications Research Institute (ETRI) (Project No. 10045344), Global PhD Fellowship Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (NRF-2014H1A2A1019270), and Samsung Electronics.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Kim, M., Jeong, HJ., Moon, SM. (2017). Small Footprint JavaScript Engine. In: Keramidas, G., Voros, N., Hübner, M. (eds) Components and Services for IoT Platforms. Springer, Cham. https://doi.org/10.1007/978-3-319-42304-3_6
Download citation
DOI: https://doi.org/10.1007/978-3-319-42304-3_6
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-42302-9
Online ISBN: 978-3-319-42304-3
eBook Packages: EngineeringEngineering (R0)