angular / angular/components

Autocomplete slow to update with large data sets after material beta 12

Đang mở
#7,749 18 bình luận 17 reaction 0 người được giao Xem trên GitHub
area: material/autocomplete P4 perf
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

#### Bug, feature request, or proposal:
When displaying an autocomplete list with a large number of options it is slow to display. It appears that this is caused by 2 event listeners being created for each item in the list. This slowness started after updating to beta 12.

You can see the large number of event listeners being set up if you open the Chrome dev tools and set the logging level to verbose.
`[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952`

#### What is the expected behavior?
Similar performance when using autocomplete with 200+ data sets to older versions of material.

#### What is the current behavior?
Rendering an autocomplete with a large number of options has a delay, it is even longer when the dev tools are open due to the large number of event listeners being created causing logs to be written to the console

#### What are the steps to reproduce?
Open dev tools, set console logging to verbose and click the "Click to toggle autocomplete" button .
You can also see the behavior by filtering the list, type anything to shorten the length of the list, then clear the input and new event listeners will be created again for each item in the list causing additional slowdown.
https://plnkr.co/edit/QhlHy7FrlvQbDeRfncCo?p=preview

#### What is the use-case or motivation for changing an existing behavior?
Improve performance. Is it not possible to have a single event listener on the parent that catches click events that bubble up? If not do 2 event listeners need to be created for each item in the list?

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 4.4.4
Material: beta.12
All browsers

#### Is there anything else we should know?
Event handler times on beta.11
Clearing out the input box, causing all items to be displayed again
`[Violation] 'input' handler took 187ms`
Clicking the button to display the autocomplete
`[Violation] 'click' handler took 246ms`

Event handler times on beta.12 doing the same actions
`[Violation] 'input' handler took 1347ms`
`[Violation] 'click' handler took 1048ms`

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

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

Hướng nghiên cứu

Bắt đầu với việc tái hiện autocomplete trong Plunker được liên kết và sử dụng tính năng ghi nhật ký chi tiết của Chrome DevTools để so sánh beta.12 với beta.11. Theo dõi việc tạo listener khi mở, lọc và xóa danh sách; hoàn tất khi các tập hợp tùy chọn lớn không còn gặp độ trễ liên quan đến listener đã được báo cáo và thời gian của các event-handler có thể so sánh với phiên bản cũ hơn.

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

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend, performance
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
Khá rõ ràng
Mức phù hợp với người mới
38/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.