antoniodipinto / ikisocket

🧬 WebSocket wrapper with event management for Fiber https://github.com/gofiber/fiber. Based on Fiber WebSocket and inspired by Socket.io
MIT License
123 stars 21 forks source link

fix: cpu intensive usage #29

Closed CRGao closed 1 year ago

CRGao commented 1 year ago

The current timer will cause high cpu usage

截圖 2022-12-30 下午3 54 04

antoniodipinto commented 1 year ago

@CRGao can you please show the benchmark for the new integration?

antoniodipinto commented 1 year ago

Leaving here more details based on Go documentation about time.Tick

Tick is a convenience wrapper for NewTicker providing access to the ticking channel only. While Tick is useful for clients that have no need to shut down the Ticker, be aware that without a way to shut it down the underlying Ticker cannot be recovered by the garbage collector; it "leaks". Unlike NewTicker, Tick will return nil if d <= 0

Source: https://pkg.go.dev/time?utm_source=godoc#Tick

antoniodipinto commented 1 year ago

Merged.

Thanks @CRGao

CRGao commented 1 year ago

@CRGao你能展示新集成的基準嗎?

截圖 2023-01-02 下午8 50 49