python / python/mypy

slow dmypy recheck times

Đang mở
#6,722 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

performance priority-1-normal topic-daemon topic-fine-grained-incremental
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Hi, I'm creating an issue for a problem discussed with @ilevkivskyi over at https://github.com/dropbox/mypy-PyCharm-plugin/issues/26

Ivan indicated that he's getting 300-500ms response time from dmypy on rechecks of a large code base, but on my moderately large code base, dmypy is taking over 15s to rerun if I edit any files.

I'm using 0.701.

First I start the daemon:

$ dmypy run -v -- python/packages
err                     : 
out                     : python/packages/filesize.py:51: error: I ...
platform                :     darwin
python_version          :        2_7
roundtrip_time          :     20.145
stats                   : {
'validate_meta_time': 0.005048990249633789,
'files_parsed': 819, 
'modules_parsed': 520, 
'stubs_parsed': 299, 
'parse_time': 4.495372295379639, 
'find_module_time': 0.3217315673828125, 
'find_module_calls': 5739, 
'graph_size': 819, 
'stubs_found': 299, 
'graph_load_time': 5.5668110847473145, 
'fm_cache_size': 1936, 
'sccs_left': 0, 
'nodes_left': 0, 
'cache_commit_time': 4.0531158447265625e-06, 
'load_fg_deps_time': 9.5367431640625e-07
}
status                  :          1

Then I edit a file and recheck:

$ dmypy recheck -v --update python/packages/foo.py
err                     : 
out                     : python/packages/foo.py:1 ...
platform                :     darwin
python_version          :        2_7
roundtrip_time          :     17.837
stats                   : {
'load_fg_deps_time': 2.5272369384765625e-05, 
'validate_meta_time': 1.3113021850585938e-05, 
'files_parsed': 1, 
'modules_parsed': 1, 
'stubs_parsed': 0, 
'parse_time': 0.002131938934326172, 
'find_module_time': 0.005670785903930664, 
'find_module_calls': 4, 
'semanal_time': 0.0036809444427490234,
'typecheck_time': 0.0034759044647216797, 
'deps_time': 0.001669168472290039, 
'finish_passes_time': 0.0005908012390136719, 
'update_isolated_time': 0.021294116973876953, 
'propagate_time': 0.003412961959838867, 
'find_changes_time': 0.0008490085601806641, 
'fg_update_time': 17.824305057525635,
'files_changed': 1
}
status                  :          1

Clearly the problem lies in fg_update_time!

It may be important to note that this code produces hundreds of errors. I'm using a custom mypy runner to filter out errors I'm not concerned with until my message filtering PR gets some traction.

Here's my mypy.ini:

[mypy]
python_version = 2.7
ignore_missing_imports = true
follow_imports = skip
warn_no_return = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true

Any guidance is greatly appreciated!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện các mốc thời gian được báo cáo bằng dmypy run và dmypy recheck -v --update, sử dụng các thiết lập mypy.ini được cung cấp và một codebase có thể so sánh. Bắt đầu bằng cách theo dõi thống kê fg_update_time, sau đó so sánh nó với các thời gian recheck khác và xác nhận rằng thay đổi này làm giảm độ trễ được báo cáo mà không làm thay đổi kết quả kiểm tra kiểu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
performance, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.