-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codec: remove double-indirection and fix race in Copy-On-Write during…
… TypeInfo lookup Previously, we stored a pointer to a slice as an atomic.Value. This meant that we were effectively storing a pointer to a pointer to an array. Now, we just store the pointer to the array and the length separately, and "compose" the slice using unsafe (in unsafe mode). This gave a slight perforamce increase. Also, we now create a new slice whenever we need to update the TypeInfo array. Previously, we just updated the backing array and returned a new slice object. But since the same backing array was used, it introduced a race condition. Fixes #227
- Loading branch information
Showing
3 changed files
with
31 additions
and
19 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