Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key non pointer opt #143

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Key non pointer opt #143

merged 2 commits into from
Jun 13, 2024

Conversation

JkLondon
Copy link
Member

goarch: amd64
pkg: github.com/erigontech/mdbx-go/mdbx
cpu: 12th Gen Intel(R) Core(TM) i7-12700H
                        │ txn_key_pointer.txt │       txn_key_non_pointer.txt        │
                        │       sec/op        │    sec/op     vs base                │
Cursor-20                         169.8n ± 2%   168.2n ±  1%        ~ (p=0.092 n=10)
Cursor_Renew/1-20                 57.66n ± 3%   57.40n ±  5%        ~ (p=0.895 n=10)
Cursor_Renew/2-20                 55.76n ± 2%   55.95n ±  3%        ~ (p=0.225 n=10)
Cursor_Renew/3-20                 167.4n ± 4%   167.5n ±  1%        ~ (p=0.927 n=10)
Cursor_Renew/4-20                 61.62n ± 5%   61.87n ±  4%        ~ (p=0.481 n=10)
Cursor_SetRange-20                89.00n ± 3%   76.91n ±  2%  -13.59% (p=0.000 n=10)
Errno_Error-20                    364.7n ± 7%   348.7n ± 10%        ~ (p=0.165 n=10)
Txn_abort-20                      217.7n ± 2%   220.7n ±  5%        ~ (p=0.066 n=10)
Txn_ro-20                         433.4n ± 6%   428.3n ±  6%        ~ (p=0.579 n=10)
Txn_unmanaged_abort-20            191.6n ± 4%   201.3n ±  3%   +5.09% (p=0.001 n=10)
Txn_unmanaged_commit-20           197.4n ± 3%   203.3n ±  3%   +2.99% (p=0.001 n=10)
Txn_unmanaged_ro-20               281.8n ± 2%   261.6n ±  3%   -7.19% (p=0.000 n=10)
Txn_renew-20                      118.9n ± 4%   114.4n ±  3%   -3.78% (p=0.037 n=10)
Txn_Get-20                        72.98n ± 4%   72.21n ±  1%   -1.06% (p=0.015 n=10)
geomean                           143.7n        141.2n         -1.70%

@AskAlexSharov AskAlexSharov merged commit 39eccf6 into master Jun 13, 2024
4 of 5 checks passed
@@ -92,13 +92,13 @@ func beginTxn(env *Env, parent *Txn, flags uint) (*Txn, error) {
if flags&Readonly == 0 {
// In a write Txn we can use the shared, C-allocated key and value
// allocated by env, and freed when it is closed.
txn.key = env.ckey
txn.key = *env.ckey
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need this line anymore

} else {
// It is not easy to share C.MDBX_val values in this scenario unless
// there is a synchronized pool involved, which will increase
// overhead. Further, allocating these values with C will add
// overhead both here and when the values are freed.
txn.key = new(C.MDBX_val)
txn.key = C.MDBX_val{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need this line anymore

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

txn.key = parent.key also

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants