Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
09185538
Commit
09185538
authored
Jul 07, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/neo/t/tzodb.go: errgroup -> xsync.WorkGroup
See
go123@515a6d14
parent
ea53a795
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
go/neo/t/tzodb.go
go/neo/t/tzodb.go
+6
-7
No files found.
go/neo/t/tzodb.go
View file @
09185538
// Copyright (C) 2017-20
19
Nexedi SA and Contributors.
// Copyright (C) 2017-20
20
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Kirill Smelkov <kirr@nexedi.com>
//
//
// This program is free software: you can Use, Study, Modify and Redistribute
// This program is free software: you can Use, Study, Modify and Redistribute
...
@@ -39,10 +39,9 @@ import (
...
@@ -39,10 +39,9 @@ import (
"testing"
"testing"
"time"
"time"
"golang.org/x/sync/errgroup"
"lab.nexedi.com/kirr/go123/prog"
"lab.nexedi.com/kirr/go123/prog"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xsync"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
...
@@ -322,14 +321,14 @@ func zwrk(ctx context.Context, url string, nwrk int, h hasher, bench, check stri
...
@@ -322,14 +321,14 @@ func zwrk(ctx context.Context, url string, nwrk int, h hasher, bench, check stri
// benchmark parallel loads
// benchmark parallel loads
defer
xerr
.
Contextf
(
&
err
,
"zwrk-%d/bench"
,
nwrk
)
defer
xerr
.
Contextf
(
&
err
,
"zwrk-%d/bench"
,
nwrk
)
r
:=
testing
.
Benchmark
(
func
(
b
*
testing
.
B
)
{
r
:=
testing
.
Benchmark
(
func
(
b
*
testing
.
B
)
{
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
wg
:=
xsync
.
NewWorkGroup
(
ctx
)
var
n
int64
var
n
int64
for
i
:=
0
;
i
<
nwrk
;
i
++
{
for
i
:=
0
;
i
<
nwrk
;
i
++
{
stor
:=
storv
[
i
]
stor
:=
storv
[
i
]
oid
:=
zodb
.
Oid
(
0
)
oid
:=
zodb
.
Oid
(
0
)
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
for
{
for
{
n
:=
atomic
.
AddInt64
(
&
n
,
+
1
)
n
:=
atomic
.
AddInt64
(
&
n
,
+
1
)
if
n
>=
int64
(
b
.
N
)
{
if
n
>=
int64
(
b
.
N
)
{
...
@@ -382,10 +381,10 @@ func zwrkPreconnect(ctx context.Context, url string, at zodb.Tid, nwrk int) (_ [
...
@@ -382,10 +381,10 @@ func zwrkPreconnect(ctx context.Context, url string, at zodb.Tid, nwrk int) (_ [
defer
xerr
.
Contextf
(
&
err
,
"zwrk-%d/preconnect"
,
nwrk
)
defer
xerr
.
Contextf
(
&
err
,
"zwrk-%d/preconnect"
,
nwrk
)
storv
:=
make
([]
zodb
.
IStorage
,
nwrk
)
storv
:=
make
([]
zodb
.
IStorage
,
nwrk
)
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
wg
:=
xsync
.
NewWorkGroup
(
ctx
)
for
i
:=
0
;
i
<
nwrk
;
i
++
{
for
i
:=
0
;
i
<
nwrk
;
i
++
{
i
:=
i
i
:=
i
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
// open storage without caching - we need to take
// open storage without caching - we need to take
// latency of every request into account, and a cache
// latency of every request into account, and a cache
// could be inhibiting (e.g. making significantly
// could be inhibiting (e.g. making significantly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment