Salvato in:
Dettagli Bibliografici
Autori principali: Richey, Cynthia, Cutler, Joseph W., Goldstein, Harrison, Pierce, Benjamin C.
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:https://arxiv.org/abs/2503.19797
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866910108437446656
author Richey, Cynthia
Cutler, Joseph W.
Goldstein, Harrison
Pierce, Benjamin C.
author_facet Richey, Cynthia
Cutler, Joseph W.
Goldstein, Harrison
Pierce, Benjamin C.
contents Property-based testing (PBT) relies on generators for random test cases, often constructed using embedded domain specific languages, which provide expressive combinators for building and composing generators. The effectiveness of PBT depends critically on the speed of these generators. However, careful measurements show that the generator performance of widely used PBT libraries falls well short of what is possible, due principally to (1) the abstraction overhead of their combinator-heavy style and (2) suboptimal sources of randomness. We characterize, quantify, and address these bottlenecks. To eliminate abstraction overheads, we propose a technique based on multi-stage programming, dubbed Allegro. We apply this technique to leading generator libraries in OCaml and Scala 3, significantly improving performance. To quantify the performance impact of the randomness source, we carry out a controlled experiment, replacing the randomness in the OCaml PBT library with an optimized version. Both interventions exactly preserve the semantics of generators, enabling precise, pointwise comparisons. Together, these improvements find bugs up to $13\times$ faster.
format Preprint
id arxiv_https___arxiv_org_abs_2503_19797
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Fail Faster: Staging and Fast Randomness for High-Performance PBT
Richey, Cynthia
Cutler, Joseph W.
Goldstein, Harrison
Pierce, Benjamin C.
Programming Languages
Property-based testing (PBT) relies on generators for random test cases, often constructed using embedded domain specific languages, which provide expressive combinators for building and composing generators. The effectiveness of PBT depends critically on the speed of these generators. However, careful measurements show that the generator performance of widely used PBT libraries falls well short of what is possible, due principally to (1) the abstraction overhead of their combinator-heavy style and (2) suboptimal sources of randomness. We characterize, quantify, and address these bottlenecks. To eliminate abstraction overheads, we propose a technique based on multi-stage programming, dubbed Allegro. We apply this technique to leading generator libraries in OCaml and Scala 3, significantly improving performance. To quantify the performance impact of the randomness source, we carry out a controlled experiment, replacing the randomness in the OCaml PBT library with an optimized version. Both interventions exactly preserve the semantics of generators, enabling precise, pointwise comparisons. Together, these improvements find bugs up to $13\times$ faster.
title Fail Faster: Staging and Fast Randomness for High-Performance PBT
topic Programming Languages
url https://arxiv.org/abs/2503.19797