Skip to content

Definitions and scopes performance on checker-ligo

Clone https://github.com/marigold-dev/checker-ligo and open it in VSCode, and in your terminal, try the following:

# Typer, scopes
time ligo info get-scope /home/heitor/Work/ligo-repos/checker-ligo/src/checker.mligo --format dev --with-types --no-stdlib > /dev/null 
ligo info get-scope  --format dev --with-types --no-stdlib > /dev/null  21.86s user 0.19s system 99% cpu 22.088 total

As indicated by the snippet above, in my machine, we took almost 22 seconds to fetch definitions and scopes from this file. The problem is mostly aggravated by two things: the presence of the --with-types flag, and the lack of the --defs-only flag. Below are some more numbers:

# No typer, no scopes
time ligo info get-scope /home/heitor/Work/ligo-repos/checker-ligo/src/checker.mligo --format dev --no-stdlib --defs-only > /dev/null 
ligo info get-scope  --format dev --no-stdlib --defs-only > /dev/null  2.11s user 0.06s system 99% cpu 2.173 total
# Typer, no scopes
time ligo info get-scope /home/heitor/Work/ligo-repos/checker-ligo/src/checker.mligo --format dev --with-types --no-stdlib --defs-only > /dev/null
ligo info get-scope  --format dev --with-types --no-stdlib --defs-only >   14.20s user 0.23s system 99% cpu 14.448 total
# No typer, scopes
time ligo info get-scope /home/heitor/Work/ligo-repos/checker-ligo/src/checker.mligo --format dev --no-stdlib > /dev/null 
ligo info get-scope  --format dev --no-stdlib > /dev/null  11.66s user 0.09s system 99% cpu 11.767 total

I don't know how much pretty-printing the results influences the benchmarks, but even in VSCode, this delay is still very real. We should investigate what causes this slowdown and fix it.

Acceptance criteria

  • We investigate what causes the slowdown in scopes pass and fix it.
  • We investigate what causes the slowdown in types pass and fix it.