refactor(dispatch): remove unused direct dispatcher and dead fields
- commit
- 60778dcb91359787290612e001ca948a7ac1a797
- author
- brice · · 2026-09-28 07:42 UTC
- parent
- 3e99709
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +0 -35
M event_pool.go +0 -34
| @@ -27,10 +27,6 @@ type EventDispatcher struct { | |||
| 27 | 27 | ||
| 28 | 28 | // Extended handlers for object IDs >= 1024 (rare case) | |
| 29 | 29 | extHandlers sync.Map | |
| 30 | - | ||
| 31 | - | // Pre-allocated event objects to avoid allocations | |
| 32 | - | eventCache [64]Event | |
| 33 | - | eventIndex atomic.Uint32 | |
| 34 | 30 | } | |
| 35 | 31 | ||
| 36 | 32 | // handlerEntry stores handlers for a specific object | |
| @@ -166,36 +162,6 @@ type RawEvent struct { | |||
| 166 | 162 | Data []byte | |
| 167 | 163 | } | |
| 168 | 164 | ||
| 169 | - | // DirectDispatcher provides the absolute fastest dispatch path for hot events | |
| 170 | - | type DirectDispatcher struct { | |
| 171 | - | // Direct function pointers for the hottest paths (e.g., pointer motion) | |
| 172 | - | pointerMotion func(surfaceX, surfaceY Fixed) | |
| 173 | - | pointerButton func(button, state uint32) | |
| 174 | - | keyboardKey func(key, state uint32) | |
| 175 | - | frameCallback func(callbackData uint32) | |
| 176 | - | ||
| 177 | - | // Fallback to regular dispatcher | |
| 178 | - | fallback *EventDispatcher | |
| 179 | - | } | |
| 180 | - | ||
| 181 | - | // DispatchPointerMotion dispatches pointer motion events with zero overhead | |
| 182 | - | // | |
| 183 | - | //go:inline | |
| 184 | - | func (d *DirectDispatcher) DispatchPointerMotion(surfaceX, surfaceY Fixed) { | |
| 185 | - | if d.pointerMotion != nil { | |
| 186 | - | d.pointerMotion(surfaceX, surfaceY) | |
| 187 | - | } | |
| 188 | - | } | |
| 189 | - | ||
| 190 | - | // DispatchPointerButton dispatches pointer button events with zero overhead | |
| 191 | - | // | |
| 192 | - | //go:inline | |
| 193 | - | func (d *DirectDispatcher) DispatchPointerButton(button, state uint32) { | |
| 194 | - | if d.pointerButton != nil { | |
| 195 | - | d.pointerButton(button, state) | |
| 196 | - | } | |
| 197 | - | } | |
| 198 | - | ||
| 199 | 165 | // Ensure cache line alignment for hot data structures | |
| 200 | 166 | type cacheLinePad [64]byte | |
| 201 | 167 | ||
| @@ -27,10 +27,6 @@ type EventDispatcher struct { | |||||
| 27 | 27 | ||||
| 28 | // Extended handlers for object IDs >= 1024 (rare case) | 28 | // Extended handlers for object IDs >= 1024 (rare case) | ||
| 29 | extHandlers sync.Map | 29 | extHandlers sync.Map | ||
| 30 | - | ||||
| 31 | - | // Pre-allocated event objects to avoid allocations | |||
| 32 | - | eventCache [64]Event | |||
| 33 | - | eventIndex atomic.Uint32 | |||
| 34 | } | 30 | } | ||
| 35 | 31 | ||||
| 36 | // handlerEntry stores handlers for a specific object | 32 | // handlerEntry stores handlers for a specific object | ||
| @@ -166,36 +162,6 @@ type RawEvent struct { | |||||
| 166 | Data []byte | 162 | Data []byte | ||
| 167 | } | 163 | } | ||
| 168 | 164 | ||||
| 169 | - | // DirectDispatcher provides the absolute fastest dispatch path for hot events | |||
| 170 | - | type DirectDispatcher struct { | |||
| 171 | - | // Direct function pointers for the hottest paths (e.g., pointer motion) | |||
| 172 | - | pointerMotion func(surfaceX, surfaceY Fixed) | |||
| 173 | - | pointerButton func(button, state uint32) | |||
| 174 | - | keyboardKey func(key, state uint32) | |||
| 175 | - | frameCallback func(callbackData uint32) | |||
| 176 | - | ||||
| 177 | - | // Fallback to regular dispatcher | |||
| 178 | - | fallback *EventDispatcher | |||
| 179 | - | } | |||
| 180 | - | ||||
| 181 | - | // DispatchPointerMotion dispatches pointer motion events with zero overhead | |||
| 182 | - | // | |||
| 183 | - | //go:inline | |||
| 184 | - | func (d *DirectDispatcher) DispatchPointerMotion(surfaceX, surfaceY Fixed) { | |||
| 185 | - | if d.pointerMotion != nil { | |||
| 186 | - | d.pointerMotion(surfaceX, surfaceY) | |||
| 187 | - | } | |||
| 188 | - | } | |||
| 189 | - | ||||
| 190 | - | // DispatchPointerButton dispatches pointer button events with zero overhead | |||
| 191 | - | // | |||
| 192 | - | //go:inline | |||
| 193 | - | func (d *DirectDispatcher) DispatchPointerButton(button, state uint32) { | |||
| 194 | - | if d.pointerButton != nil { | |||
| 195 | - | d.pointerButton(button, state) | |||
| 196 | - | } | |||
| 197 | - | } | |||
| 198 | - | ||||
| 199 | // Ensure cache line alignment for hot data structures | 165 | // Ensure cache line alignment for hot data structures | ||
| 200 | type cacheLinePad [64]byte | 166 | type cacheLinePad [64]byte | ||
| 201 | 167 | ||||
M shm.go +0 -1
| @@ -7,7 +7,6 @@ import ( | |||
| 7 | 7 | ||
| 8 | 8 | // ShmPool represents a shared memory pool | |
| 9 | 9 | type ShmPool struct { | |
| 10 | - | id uint32 | |
| 11 | 10 | fd int | |
| 12 | 11 | size int | |
| 13 | 12 | data []byte | |
| @@ -7,7 +7,6 @@ import ( | |||||
| 7 | 7 | ||||
| 8 | // ShmPool represents a shared memory pool | 8 | // ShmPool represents a shared memory pool | ||
| 9 | type ShmPool struct { | 9 | type ShmPool struct { | ||
| 10 | - | id uint32 | |||
| 11 | fd int | 10 | fd int | ||
| 12 | size int | 11 | size int | ||
| 13 | data []byte | 12 | data []byte | ||