HackerPapers

arXiv:2403.02420cs.PL

Dr Wenowdis: Specializing dynamic language C extensions using type information

Maxwell Bernstein, CF Bolz-Tereick

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

C-based interpreters such as CPython make extensive use of C "extension" code, which is opaque to static analysis tools and faster runtimes with JIT compilers, such as PyPy. Not only are the extensions opaque, but the interface between the dynamic language types and the C types can introduce impedance. We hypothesise that frequent calls to C extension code introduce significant overhead that is often unnecessary. We validate this hypothesis by introducing a simple technique, "typed methods", which allow selected C extension functions to have additional metadata attached to them in a backward-compatible way. This additional metadata makes it much easier for a JIT compiler (and as we show, even an interpreter!) to significantly reduce the call and return overhead. Although we have prototyped typed methods in PyPy, we suspect that the same technique is applicable to a wider variety of language runtimes and that the information can also be consumed by static analysis tooling.

arXiv comments
Journal reference
DOI
doi:10.1145/3652588.3663316
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Mar 2024 to Mar 2024. Found in 1 HN submission from Apr 2024 to Apr 2024. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

    • We built something similar for pypy! See the blog post: https://bernsteinbear.com/blog/typed-c-extensions/ and paper: https://arxiv.org/abs/2403.02420 TL;DR: similar speedups! It works well

      tekknolagiView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.