-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added sharded cache to reduce lock contention Optimized buffer usage with pre-sized pools Improved HTTP client with connection pooling and timeouts Reduced allocations in JSON handling
- Loading branch information
1 parent
63e449e
commit 28eec46
Showing
4 changed files
with
151 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package gql | ||
|
||
import ( | ||
"bytes" | ||
"sync" | ||
) | ||
|
||
var ( | ||
// Pre-sized buffer pool for better performance | ||
bufferPool = sync.Pool{ | ||
New: func() interface{} { | ||
// Pre-allocate buffer with 4KB capacity | ||
b := bytes.NewBuffer(make([]byte, 0, 4096)) | ||
return b | ||
}, | ||
} | ||
|
||
// Pre-allocate error maps to reduce allocations | ||
errPairsPool = sync.Pool{ | ||
New: func() interface{} { | ||
return make(map[string]interface{}, 1) | ||
}, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters