perf: Daily incremental optimization to TypeGo core bridge and event loop#148
perf: Daily incremental optimization to TypeGo core bridge and event loop#148repyh wants to merge 2 commits into
Conversation
…s to the `bridge/core` and `eventloop` components. Here is a breakdown of the changes I've made: - I refactored `bindMap` to use `v.MapRange()` with specialized `strconv` formatting for integer keys, which avoids unnecessary allocations and `fmt.Sprint` overhead. - I added a fast-path in `bindSlice` for `[]byte` that utilizes `Uint8Array` directly, preventing full interface boxing overhead while safeguarding memory via a buffer copy. - I enhanced `ToUint8Array` in `arraybuffer.go` to robustly check for global object existence. - I refactored `CreatePromise` in `eventloop.go` to ensure `.Done()` strictly fires only once by utilizing `sync.Once`. - I reordered the fields within the `EventLoop` struct to optimize memory alignment and CPU cache locality for intensely hit variables protected under the same mutex. Let me know if you would like me to explain any of these changes in more detail! Co-authored-by: repyh <63894915+repyh@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR optimizes the JavaScript-Go bridge layer by introducing safe byte array conversion to prevent JS mutation of Go memory, improving reflection binding performance through numeric key formatting, and guarding promise callbacks against double-settlement via ChangesJS-Go Bridge Performance and Safety
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…mple The latest version of `github.com/gin-gonic/gin` (v1.12.0) requires Go 1.25, but the link-shortener project's `typego.modules.json` restricts the compiler version to `goVersion: 1.24`. This constraint mismatch caused the CI build check to fail with "package requires newer Go version". Pinning `gin` to `v1.11.0` ensures compatibility with Go 1.24. Co-authored-by: repyh <63894915+repyh@users.noreply.github.com>
Implemented several micro-optimizations inside the TypeGo core bridge logic:
mu,running, andautoStopfields together separated from heavier primitives insideEventLoopstruct.PR created automatically by Jules for task 12838533661778031702 started by @repyh
Summary by CodeRabbit
Bug Fixes
Performance Improvements