Publicação
Highly Performant JavaScript Rules Engine
| Resumo: | Jscrambler offers a product named Webpage Integrity, which actively monitors and blocks client-side behaviors of third-party scripts running in web applications. The product core is an agent that runs in the webpage, with a rules engine built into it, dictating actions the agent takes based on rules defined by the customer. Both the agent and its engine are built with JavaScript. JavaScript is a weakly-typed scripting language used all over the internet, running in almost all websites. Being a weakly-typed and extremely flexible language presents some difficulties, mainly lack of compilation-time optimization. To tackle this, it has a built-in Just-in-time compiler, which does runtime optimizations based on several heuristics, such as the number of functions executions, or the data type in its arguments. JavaScript rules engines are a tricky case of performance. Being a very flexible tool makes the code also be very flexible, accepting a multitude of arguments and data types, which leads to the Just-in-time compiler not optimizing the code to its fullest potential. This work creates a rules engine different from the ones that are freely available for JavaScript. Instead of interpreting the rules in real time by a very flexible engine, the rules are compiled into Just-in-time compilation friendly JavaScript code, which has the same functionality. Based on a realistic test model created from one of Jscrambler’s biggest customers, results show that compiling rules into JavaScript source code brings a performance boost of up to 60 times. Lastly, results show that the Just-in-time compiler does not bring any significant performance gains in a pure JavaScript rules engine with Just-in-time compilation friendly code. |
|---|---|
| Autores principais: | Ferreira, Sérgio Filipe Santos |
| Assunto: | JavaScript Performance Rules Engine |
| Ano: | 2023 |
| País: | Portugal |
| Tipo de documento: | dissertação de mestrado |
| Tipo de acesso: | acesso embargado |
| Instituição associada: | Instituto Politécnico do Porto |
| Idioma: | inglês |
| Origem: | Repositório Científico do Instituto Politécnico do Porto |
| Resumo: | Jscrambler offers a product named Webpage Integrity, which actively monitors and blocks client-side behaviors of third-party scripts running in web applications. The product core is an agent that runs in the webpage, with a rules engine built into it, dictating actions the agent takes based on rules defined by the customer. Both the agent and its engine are built with JavaScript. JavaScript is a weakly-typed scripting language used all over the internet, running in almost all websites. Being a weakly-typed and extremely flexible language presents some difficulties, mainly lack of compilation-time optimization. To tackle this, it has a built-in Just-in-time compiler, which does runtime optimizations based on several heuristics, such as the number of functions executions, or the data type in its arguments. JavaScript rules engines are a tricky case of performance. Being a very flexible tool makes the code also be very flexible, accepting a multitude of arguments and data types, which leads to the Just-in-time compiler not optimizing the code to its fullest potential. This work creates a rules engine different from the ones that are freely available for JavaScript. Instead of interpreting the rules in real time by a very flexible engine, the rules are compiled into Just-in-time compilation friendly JavaScript code, which has the same functionality. Based on a realistic test model created from one of Jscrambler’s biggest customers, results show that compiling rules into JavaScript source code brings a performance boost of up to 60 times. Lastly, results show that the Just-in-time compiler does not bring any significant performance gains in a pure JavaScript rules engine with Just-in-time compilation friendly code. |
|---|