`stdTimer` - Cache remote workbook
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- performance, tooling
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- VBA
- Stelle
- 412
- Fork
- 70
- Merge medio
- 1g 3h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sancarn/stdVBA
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
Issues of stdRefArrayApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Tutte le issue di sancarn/stdVBA
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
drizzle-team/drizzle-orm#6619 ·
I maintainer di solito rispondono entro 2 giorni
-
SingleSegmentArena grows by the requested size only, so building a large message is quadraticAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
bug p2 qa:performance triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
saketh-kowtha/lazyhub#456 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mento-calc/mento#213 ·
I maintainer di solito rispondono entro 1 giorno