Benchmarking a baseline fully-in-place functional language compiler
Návrh a testování FIP funkcionálního jazyka
bachelor thesis (DEFENDED)
View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/202616Identifiers
Study Information System: 281820
Collections
- Kvalifikační práce [12055]
Author
Advisor
Referee
Bednárek, David
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
Computer Science with specialisation in Programming and Software Development
Department
Department of Distributed and Dependable Systems
Date of defense
5. 9. 2025
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
English
Grade
Excellent
Keywords (Czech)
FIP|Překladače|Optimalizace překladače|Programovací jazyky|funkcionální programováníKeywords (English)
FIP|Compiler|Optimizing compile|Programming languages|functional programmingFunkcionální jazyky jako Haskell a F# činí kód lépe testovatelným, inherentně více- vláknově bezpečným a snáze analyzovatelným díky omezení vedlejších efektů. Nicméně použití neměnných datových struktur přináší náklady z hlediska efektivity, protože mnoho operací vyžaduje kopírování namísto úprav na místě. Z tohoto důvodu jazyk Koka zavedl nový mechanismus zvaný fully in-place calculus (FIP kalkulus), který umožňuje bezpečné úpravy na konstantní paměti a zároveň se vyhýbá zbytečným alokacím. Správa paměti v Koce a jeho bohatá sada funkcionalit však ztěžují odlišení konkrétních přínosů FIP v oblasti úspory paměti. Cílem této práce je navrhnout minimální funkcionální jazyk jmé- nem StaFip, který podporuje fully in-place aktualizace za pomoci FIP kalkulu a který nevyužívá žádnou správu paměti (garbage collection). Jeho výkon testujeme vůči kon- venční implementaci algoritmu quicksort, vkládání do černo-červených stromů a prsto- vých stromů. Výsledky ukazují, že jazyk využívající FIP kalkulus v prostředí bez garbage collection může přinést znatelné zvýšení výkonu a úsporu paměti.
Functional languages such as Haskell and F# make code more testable, inherently thread safe and easier to reason about through their functional purity. However, the adoption of immutable data structures introduces efficiency costs, as many operations require copying rather than performing in-place modifications. To address this, the Koka language introduced a novel mechanism known as fully-in-place functional programming (FIP), which enables safe in-place updates while minimizing unnecessary memory allo- cations. Nonetheless, Koka's garbage collection and extensive feature set complicate the task of isolating FIP's specific memory efficiency advantages. The goal of this thesis is to design a minimal functional language called StaFip that supports fully in-place up- dates utilizing the FIP calculus and omitting garbage collection. This will allow for a comparison of the performance of the FIP approach against that of a conventional im- plementation for algorithms such as quicksort, red-black tree insertions, and finger tree insertions. The findings of this thesis demonstrate that a language employing the FIP calculus in a garbage collection-free environment can achieve a significant increase in performance and memory efficiency.
