python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

Prefer stub content when stub is available

Open MikhailArkhipov opened this issue 6 years ago • 4 comments

Fixes #1821

Prefer stub content when stub is available. Don't eval content beyond documentation. Increases analysis speed 20-50% depending on how many stubs are available.

MikhailArkhipov avatar Dec 18 '19 17:12 MikhailArkhipov

How does this work with partial stubs? Our typeshed is still an old copy (missing 3.8 stuff), and we bundle small targeted stubs for numpy. Does this only apply for stubs shipped directly with libraries?

jakebailey avatar Dec 18 '19 18:12 jakebailey

Change is limited to typeshed modules only. Numpy is not there so it is analyzed same way as before. Only stubs from typeshed are considered.

MikhailArkhipov avatar May 04 '20 01:05 MikhailArkhipov

Regular on import numpy

Analysis complete: 933 modules in 8785.63 ms.
Analysis version 1624 of 932 entries has been completed in 5851.16 ms.

with stubsOnly: true

Analysis complete: 933 modules in 6685.23 ms.
Analysis version 1640 of 933 entries has been completed in 4446.48 ms.

MikhailArkhipov avatar May 04 '20 01:05 MikhailArkhipov

import sys
import os
import datetime

Regular:

Analysis complete: 348 modules in 6099.82 ms.
Analysis version 574 of 309 entries has been completed in 2703.78 ms.

with stubsOnly: true

Analysis complete: 348 modules in 3079.24 ms.
Analysis version 574 of 334 entries has been completed in 1461.81 ms.

MikhailArkhipov avatar May 04 '20 01:05 MikhailArkhipov