`stdTimer` - Cache remote workbook
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- performance, tooling
Hướng nghiên cứu
Start by tracing the existing stdTimer implementation and its workbook usage. Review the proposed AddTimer, MainLoop, OnChange, and Tick flow, including how callbacks would be looked up by id. Done means multiple timers share one cached workbook, callbacks remain distinct, and the timer loop still handles different intervals.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Currently our code uses 1 workbook per timer, which is crazy slow. This is currently declared as "not really an issue" because requiring more than 1 timer is likely rare(?).
However if a work around was desired we could instead:
- Cache the workbook
- Use the
AddTimer()method of below:
Private Type Timer
current as long
frequency as long
id as string
End Type
Private Timers() as Timer
Private Const MAX_TIME as Long = 1000000
Private Const MIN_TIME as Long = 10
Sub AddTimer(ByVal iMilliseconds as long, ByVal id as string)
if iMilliseconds > MAX_TIME then iMilliseconds = MAX_TIME
if iMilliseconds < MIN_TIME then iMilliseconds = MIN_TIME
On Error Resume Next: iNext = ubound(Timers)+1: On Error GoTo 0
Redim Timers(0 to iNext)
With Timers(iNext)
Timers.current = 0
Timers.frequency = iMilliseconds
Timers.id= id
End With
End Sub
Sub MainLoop()
set r = Sheet1.Cells(1,1)
While True
For each timer in Timers
timer.current = timer.current + 1
if timer.current mod timer.frequency = 0 then
r.Value = id
timer.current = 0 'saves having to deal with overflows
end if
next
Doevents
Sleep 1
Wend
End Sub
OnChangeuse theid = Target.Valueand lookupidin a dictionary to find callback. Also pass id to Tick event.
This can handle multiple timers each added at different times. Unfortunately as new timers are added the whole class slows down, but perhaps this is ok.
- Ngôn ngữ chính
- VBA
- Star
- 412
- Fork
- 70
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sancarn/stdVBA
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
-
Issues of stdRefArrayĐang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của sancarn/stdVBA
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
drizzle-team/drizzle-orm#6619 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
SingleSegmentArena grows by the requested size only, so building a large message is quadraticĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug p2 qa:performance triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
saketh-kowtha/lazyhub#456 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mento-calc/mento#213 ·
Maintainer thường phản hồi trong vòng 1 ngày