Automatic migration from synchronous to asynchronous JavaScript APIs

Author:

Gokhale Satyajit1,Turcotte Alexi1,Tip Frank1

Affiliation:

1. Northeastern University, USA

Abstract

The JavaScript ecosystem provides equivalent synchronous and asynchronous Application Programming Interfaces (APIs) for many commonly used I/O operations. Synchronous APIs involve straightforward sequential control flow that makes them easy to use and understand, but their "blocking" behavior may result in poor responsiveness or performance. Asynchronous APIs impose a higher syntactic burden that relies on callbacks, promises, and higher-order functions. On the other hand, their nonblocking behavior enables applications to scale better and remain responsive while I/O requests are being processed. While it is generally understood that asynchronous APIs have better performance characteristics, many applications still rely on synchronous APIs. In this paper, we present a refactoring technique for assisting programmers with the migration from synchronous to asynchronous APIs. The technique relies on static analysis to determine where calls to synchronous API functions can be replaced with their asynchronous counterparts, relying on JavaScript's async/await feature to minimize disruption to the source code. Since the static analysis is potentially unsound, the proposed refactorings are presented as suggestions that must be reviewed and confirmed by the programmer. The technique was implemented in a tool named Desynchronizer. In an empirical evaluation on 12 subject applications containing 316 synchronous API calls, Desynchronizer identified 256 of these as candidates for refactoring. Of these candidates, 244 were transformed successfully, and only 12 resulted in behavioral changes. Further inspection of these cases revealed that the majority of these issues can be attributed to unsoundness in the call graph.

Funder

NSF

NSERC

Publisher

Association for Computing Machinery (ACM)

Subject

Safety, Risk, Reliability and Quality,Software

Reference23 articles.

1. 2020. ECMAScript 2020 Language Specification. https://www.ecma-international.org/ecma-262/11.0/ 2020. ECMAScript 2020 Language Specification. https://www.ecma-international.org/ecma-262/11.0/

2. 2021. Express Web Framework for JavaScript. http://expressjs.com/ 2021. Express Web Framework for JavaScript. http://expressjs.com/

3. 2021. Jest: A delightful JavaScript Testing Framework. https://jestjs.io/ 2021. Jest: A delightful JavaScript Testing Framework. https://jestjs.io/

4. 2021. Mocha - the fun simple flexible JavaScript test framework. https://mochajs.org/ 2021. Mocha - the fun simple flexible JavaScript test framework. https://mochajs.org/

Cited by 8 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Code Coverage Criteria for Asynchronous Programs;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30

2. Increasing the Responsiveness of Web Applications by Introducing Lazy Loading;2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE);2023-09-11

3. An Automatic Transformer from Sequential to Parallel Java Code;Future Internet;2023-09-08

4. reformulator: Automated Refactoring of the N+1 Problem in Database-Backed Applications;Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering;2022-10-10

5. On the design of an interactive automatic Python programming skills assessment system;2022 14th International Conference on Electronics, Computers and Artificial Intelligence (ECAI);2022-06-30

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3