Skip to content

[#2143] Optimize following passes in LSP

Leonid Vasilev requested to merge dk318/#2143-optimize-following-passes into dev

Motivation and Context

In this MR some parts of the following passes in LSP were optimized (all numbers are provided for the checker contract):

  1. Self_ast_typed pass now takes 171.27M cycles instead of 777.17M.
  2. inline_lets pass in self_mini_c now traverses AST only once.

A comparison of old and new inline_lets pass:

Implementation Number of iterations all_expression inline_lets Percentage of inline_lets in all_expression
Old 8 587.98M 545.01M 92.69%
New 4 57.28M 11.95M 20.87%

Related issues

Resolves a part of #2143 .

Checklist for the LIGO Language Server

  • I checked whether I need to update the file for the plugin and did so if necessary:
    • If I implemented a new LSP request, I added it to the list of supported features that may be disabled
    • If I implemented a new LSP method, I added it to the list of supported functionality
  • I checked that my changes work in Emacs, Vim, and Visual Studio Code
  • (Before merging) The commit history is squashed and prettified, and follows the Serokell commit policy, or the MR is set to squash the commits



  • 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)


Improved performance for LSP and compilation pipeline.

The LSP should now take less time between keystrokes.

This is done by optimizing self_ast_typed and self_mini_c passes.


  • 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).

Merge request reports