Analysis of WebAssembly as a Strategy to Improve JavaScript Performance on IoT Environments

  • Fernando Oliveira UFPel
  • Júlio Mattos UFPel

Resumo


JavaScript language (JS) has been widely used in recent years applied to browsers-context. Yet JS is being applied to other backgrounds such as server-side programming, mobile applications, games, robotics, and the Internet of Things (IoT). JavaScript is suitable for programming IoT devices due to eventdriven oriented architecture. However, it is an interpreted language, so it has a lower performance than a compiled language. This paper assesses the use of WebAssembly as a strategy to improve the performance of JavaScript applications in the IoT environment. The experiments were performed on a Raspberry Pi using the Ostrich Benchmark Suite. We run the algorithms in JavaScript, WebAssembly, and C language while collecting data about device resource consumption. Our results showed that JavaScript performance could be improved by 39.81% in terms of execution time, a tiny gain in memory usage, and reduced battery consumption by 39.86% when using WebAssembly.

Palavras-chave: JavaScript, WebAssembly, Raspberry PI, Internet of Things

Referências

L. Amorim, R. Barreto, and M. Alencar, “Tiny thing blocks: Integrating everyday objects into iot context,” in IX Brazilian Symposium on Computing Systems Engineering. Porto Alegre, RS, Brasil: SBC, 2019, pp. 131–136.

Transforma Insights, “The internet of things (iot) market 2019- 2030,” https://transformainsights.com/news/iot-market-24-billion-usd15- trillion-revenue-2030, 2020, accressed: jun. 2020.

S. Delcev and D. Draskovic, “Modern javascript frameworks: A survey study,” in 2018 Zooming Innovation in Consumer Technologies Confer- ence (ZINC), May 2018, pp. 106–109.

Stack Overflow, “Stack overflow annual developer survey 2020,” https://insights.stackoverflow.com/survey/2020, 2020, accressed: jun. 2020.

Developer Economics, “State of the developer nation - 18 edition,” https://www.developereconomics.com, 2020, accressed: jun. 2020.

A. E. Kwame, E. M. Martey, and A. G. Chris, “Qualitative assessment of compiled, interpreted and hybrid programming languages,” Communications, vol. 7, pp. 8–13, 2017.

M. Selakovic and M. Pradel, “Performance issues and optimizations in javascript: An empirical study,” in 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE), 2016, pp. 61–72.

A. Haas, A. Rossberg, D. L. Schuff, B. L. Titzer, M. Holman, D. Gohman, L. Wagner, A. Zakai, and J. Bastien, “Bringing the web up to speed with webassembly,” in Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, ser. PLDI 2017. New York, NY, USA: Association for Computing Machinery, 2017, p. 185–200. [Online]. Available: https://doi.org/10.1145/3062341.3062363

D. Flanagan, JavaScript: the definitive guide. ” O’Reilly Media, Inc.”, 2006.

V8 JavaScript Engine, “Javascript and webassembly engine,” https://v8.dev/, 2020, accressed: jul. 2020.

Node JS, “Javascript runtime,” https://nodejs.org, 2020, accressed: jul. 2020.

WebAssembly Official Website, “Webassembly official website,” https://webassembly.org/, 2020, accressed: jul. 2020.

M. Reiser and L. Bla ser, “Accelerate javascript applications by cross- compiling to webassembly,” in Proceedings of the 9th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Lan- guages, 2017, pp. 10–17.

D. Herrera, H. Chen, E. Lavoie, and L. Hendren, “Webassembly and javascript challenge: Numerical program performance using modern browser technologies and devices,” University of McGill, Montreal: QC, Technical report SABLE-TR-2018-2, 2018.

A.Jangda,B.Powers,E.D.Berger,andA.Guha,“Notsofast:analyzing the performance of webassembly vs. native code,” in 2019 {USENIX} Annual Technical Conference ({USENIX}{ATC} 19), 2019, pp. 107– 120.

Q. He, B. Segee, and V. Weaver, “Raspberry pi 2 b+ gpu power, perfor- mance, and energy implications,” in 2016 International Conference on Computational Science and Computational Intelligence (CSCI), 2016, pp. 163–167.

Khan, Faiz and Foley-Bourgon, Vincent and Kathrotia, Sujay and Lavoie, Erick, “Ostrich benchmark suite.” [Online]. Available: https://github.com/Sable/Ostrich

Emscripten, “Emscripten toolchain,” https://emscripten.org, 2020, ac- cressed: jul. 2020.

Texas Instruments, “Ina219 data sheet,” https://www.ti.com/lit/gpn/ina219, 2020, accressed: jul. 2020.

A. Georges, D. Buytaert, and L. Eeckhout, “Statistically rigorous java performance evaluation,” in Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, ser. OOPSLA ’07. New York, NY, USA: Association for Computing Machinery, 2007, p. 57–76. [Online]. Available: https://doi.org/10.1145/1297027.1297033

A.GuermoucheandA.-C.Orgerie,“Experimentalanalysisofvectorized instructions impact on energy and power consumption under thermal design power constraints,” 2019.
Publicado
23/11/2020
Como Citar

Selecione um Formato
OLIVEIRA, Fernando; MATTOS, Júlio. Analysis of WebAssembly as a Strategy to Improve JavaScript Performance on IoT Environments. In: TRABALHOS EM ANDAMENTO - SIMPÓSIO BRASILEIRO DE ENGENHARIA DE SISTEMAS COMPUTACIONAIS (SBESC), 10. , 2020, Evento Online. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2020 . p. 133-138. ISSN 2763-9002. DOI: https://doi.org/10.5753/sbesc_estendido.2020.13102.