Compilation of mathematical expressions in Kotlin
Iaroslav Postovalov

TL;DR
This paper presents a middle-ground approach for interpreting mathematical expressions in Kotlin by generating an AST with the KMath library and compiling it just-in-time to JVM bytecode, with performance evaluations across platforms.
Contribution
It introduces a novel method combining DSL-based AST generation with JIT compilation in Kotlin for efficient mathematical expression evaluation.
Findings
Performance varies across Kotlin platforms
AST generation is efficient for mathematical expressions
JIT compilation improves runtime performance
Abstract
Interpreting mathematical expressions at runtime is a standard task in scientific software engineering. There are different approaches to this problem from creating an embedded domain-specific language (eDSL) with its own parser and interpreter specifically for that task, to using a full-fledged embedded compiler. This article is dedicated to a middle-ground solution implemented in the KMath library, which uses the Kotlin object builder DSL and its own algebraic abstractions to generate an AST for mathematical operations. This AST is then compiled just-in-time to generate JVM bytecode. A similar approach is tested on other Kotlin platforms, where its performance is compared across a variety of supported platforms.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Logic, programming, and type systems · Distributed and Parallel Computing Systems
