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]`.
341 lines
12 KiB
Text
341 lines
12 KiB
Text
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 10, "character": 17}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 13, "character": 18}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 17, "character": 2}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 21, "character": 3}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 25, "character": 5}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 29, "character": 9}}
|
|
{"items": [], "isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 34, "character": 4}}
|
|
{"items": [], "isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 39, "character": 2}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 43, "character": 12}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 46, "character": 17}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 50, "character": 2}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 55, "character": 3}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 60, "character": 5}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 66, "character": 4}}
|
|
{"items": [], "isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 72, "character": 2}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 78, "character": 4}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 82, "character": 27}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 85, "character": 32}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 88, "character": 32}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]},
|
|
{"label": "bar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 91, "character": 33}}
|
|
{"items":
|
|
[{"label": "foo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]},
|
|
{"label": "foobar",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]},
|
|
{"label": "barfoo",
|
|
"kind": 5,
|
|
"detail": "field",
|
|
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
|
"position": {"line": 96, "character": 52}}
|
|
{"items":
|
|
[{"label": "aLongUniqueIdentifier",
|
|
"kind": 21,
|
|
"data":
|
|
["«external:file:///completionStructureInstance.lean»",
|
|
96,
|
|
52,
|
|
0,
|
|
"caLongUniqueIdentifier"]}],
|
|
"isIncomplete": false}
|