# Specialization of Generic Array Accesses After Inlining

**Authors:** Ryohei Tokuda (Graduate School of Information Sciences, Tohoku, University, Sendai, Japan), Eijiro Sumii (Graduate School of Information, Sciences, Tohoku University, Sendai, Japan), Akinori Abe (Graduate School of, Information Sciences, Tohoku University, Sendai, Japan)

arXiv: 1702.02283 · 2017-02-09

## TL;DR

This paper presents an optimization in the OCaml compiler that specializes array accesses after inlining, reducing runtime dispatch and improving numerical program performance by up to 21%.

## Contribution

It introduces a type specialization technique for array accesses post-inlining, leveraging explicit type application to optimize polymorphic array operations.

## Key findings

- Achieved up to 21% speed-up in numerical programs.
- Extended intermediate language with explicit type application.
- Effectively reduces runtime type dispatch for polymorphic arrays.

## Abstract

We have implemented an optimization that specializes type-generic array accesses after inlining of polymorphic functions in the native-code OCaml compiler. Polymorphic array operations (read and write) in OCaml require runtime type dispatch because of ad hoc memory representations of integer and float arrays. It cannot be removed even after being monomorphized by inlining because the intermediate language is mostly untyped. We therefore extended it with explicit type application like System F (while keeping implicit type abstraction by means of unique identifiers for type variables). Our optimization has achieved up to 21% speed-up of numerical programs.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1702.02283/full.md

## References

17 references — full list in the complete paper: https://tomesphere.com/paper/1702.02283/full.md

---
Source: https://tomesphere.com/paper/1702.02283