Skip to content

[#1990] Build system: Persistent env

Dmitry requested to merge krendelhoff/#1990-persistent-env into dev

Motivation and Context

Related issue: #1990

Description

Persistent env is represented as a map of Cmi.t, along with metadata and virtual env, which consists of signature items not related to any compile unit, such as stdlib. Cmis are represented as path to the original file, paths to its dependencies and its signature. bin_prot library was chosen for the serialization/deserealization of cmi files.

Serialization of Ast_typed.signature requires quite a lot of space, even for small files. One observation that was made is that path to the file itself is repeated all over the Ast_typed.signature, because every Pos.t contains Lexing.position inside. It was decided to make Simple_utils.Pos.Serialized.t, which contained numerical index instead of file path, and all filepaths were moved to the intmap as values. Since almost every type contained Pos.t inside, serialized version of every of them had to be created.
In the end, cmi containing Ast_typed.Serialized.signature requires 2-3 times less space, than containing Ast_typed.signature one. It is the only space optimization made so far.

Component

  • compiler
  • website
  • webide
  • vscode-plugin
  • debugger

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Checklist:

  • If a new syntax has been introduced, put a message on slack ligo-lsp
  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Dmitry

Merge request reports