vekatze / neut

A functional programming language with static memory management
https://vekatze.github.io/neut/
MIT License
840 stars 11 forks source link

improve completion-related stuff #210

Closed vekatze closed 1 month ago

vekatze commented 1 month ago

the effect of the performance fix on textDocument/completion

# before
❯ hyperfine "neut bench-completion"
Benchmark 1: neut bench-completion
  Time (mean ± σ):     215.8 ms ±   8.9 ms    [User: 725.7 ms, System: 680.6 ms]
  Range (min … max):   207.4 ms … 242.3 ms    14 runs

# after
❯ hyperfine "neut bench-completion"
Benchmark 1: neut bench-completion
  Time (mean ± σ):      45.7 ms ±   1.4 ms    [User: 26.2 ms, System: 25.0 ms]
  Range (min … max):    41.8 ms …  48.9 ms    63 runs

The subcommand bench-completion is only for this performance comparison (not commited to main); The internal of the subcommand is essentially as follows:

benchCompletion :: App ()
benchCompletion = do
  result <- runAppM $ complete (Uri "file:///path/to/some/file.nt") (Position 10 0)
  case result of
    Left es -> do
      printErrorList es
      printNote' "err"
    Right _ ->
      printNote' "pass"
  return ()