This PR speeds up auto-completion by a factor of ~3.5x through various performance improvements in the language server. On one machine, with `import Mathlib`, completing `i` used to take 3200ms and now instead yields a result in 920ms. Specifically, the following improvements are made: - The watchdog process no longer de-serializes and re-serializes most messages from the file worker before passing them on to the user - a fast partial de-serialization procedure is now used to determine whether the message needs to be de-serialized in full or not. - `escapePart` is optimized to perform better on ASCII strings that do not need escaping. - `Json.compress` is optimized to allocate fewer objects. - A faster JSON compression specifically for completion responses is implemented that skips allocating `Json` altogether. - The JSON compression has been moved to the task where we convert a request response to `Json` so that converting to a string won't block the output task of the FileWorker and so the `Json` value is not marked as multi-threaded when we compress is, which drastically increases the cost of reference-counting. - The JSON representation of the `data?` field of each completion item is optimized. - Both the completion kind and the set of completion tags for each imported completion item is now cached. - The filtering of duplicate completion items is optimized. Other adjustments: - `LT UInt8` and `LE UInt8` are moved to Prelude so that they can be used in `Init.Meta` for the name part escaping fast path. - `Array.usize` is exposed since it was marked as `@[simp]`.
86 lines
2.8 KiB
Text
86 lines
2.8 KiB
Text
{"textDocument": {"uri": "file:///1265.lean"},
|
|
"position": {"line": 0, "character": 51}}
|
|
{"items":
|
|
[{"label": "getScientific",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getScientific"]},
|
|
{"label": "getString",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getString"]},
|
|
{"label": "getNat",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getNat"]},
|
|
{"label": "getName",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getName"]},
|
|
{"label": "getChar",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getChar"]},
|
|
{"label": "raw",
|
|
"kind": 5,
|
|
"data": ["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.raw"]},
|
|
{"label": "getDocString",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getDocString"]},
|
|
{"label": "expandInterpolatedStr",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»",
|
|
0,
|
|
51,
|
|
1,
|
|
"cLean.TSyntax.expandInterpolatedStr"]},
|
|
{"label": "getHygieneInfo",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getHygieneInfo"]},
|
|
{"label": "getId",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 0, 51, 1, "cLean.TSyntax.getId"]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///1265.lean"},
|
|
"position": {"line": 2, "character": 53}}
|
|
{"items":
|
|
[{"label": "getScientific",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getScientific"]},
|
|
{"label": "getString",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getString"]},
|
|
{"label": "getNat",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getNat"]},
|
|
{"label": "getName",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getName"]},
|
|
{"label": "getChar",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getChar"]},
|
|
{"label": "raw",
|
|
"kind": 5,
|
|
"data": ["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.raw"]},
|
|
{"label": "getDocString",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getDocString"]},
|
|
{"label": "expandInterpolatedStr",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»",
|
|
2,
|
|
53,
|
|
1,
|
|
"cLean.TSyntax.expandInterpolatedStr"]},
|
|
{"label": "getHygieneInfo",
|
|
"kind": 3,
|
|
"data":
|
|
["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getHygieneInfo"]},
|
|
{"label": "getId",
|
|
"kind": 3,
|
|
"data": ["«external:file:///1265.lean»", 2, 53, 1, "cLean.TSyntax.getId"]}],
|
|
"isIncomplete": false}
|