Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
f2e7109e
Commit
f2e7109e
authored
Jul 27, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
investigate #898
parent
2b789576
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
4 deletions
+72
-4
BasicTest.csproj
BasicTest/BasicTest.csproj
+1
-1
Program.cs
BasicTest/Program.cs
+70
-2
BasicTestBaseline.csproj
BasicTestBaseline/BasicTestBaseline.csproj
+1
-1
No files found.
BasicTest/BasicTest.csproj
View file @
f2e7109e
...
...
@@ -12,7 +12,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.1
0.14
" />
<PackageReference Include="BenchmarkDotNet" Version="0.1
1.0
" />
</ItemGroup>
<ItemGroup>
...
...
BasicTest/Program.cs
View file @
f2e7109e
using
System
;
using
System.Diagnostics
;
using
System.Reflection
;
using
System.Threading.Tasks
;
using
BenchmarkDotNet.Attributes
;
...
...
@@ -22,8 +23,9 @@ internal class CustomConfig : ManualConfig
public
CustomConfig
()
{
Job
Get
(
Job
j
)
=>
j
.
With
(
new
GcMode
{
Force
=
true
});
//.With(InProcessToolchain.Instance);
.
With
(
new
GcMode
{
Force
=
true
})
.
With
(
InProcessToolchain
.
Instance
)
;
Add
(
new
MemoryDiagnoser
());
Add
(
StatisticColumn
.
OperationsPerSecond
);
...
...
@@ -157,4 +159,70 @@ public async Task<int> ExecuteGeoRadiusAsync()
return
total
;
}
}
#pragma warning disable CS1591
[
Config
(
typeof
(
CustomConfig
))]
public
class
Issue898
:
IDisposable
{
private
readonly
ConnectionMultiplexer
mux
;
private
readonly
IDatabase
db
;
public
void
Dispose
()
=>
mux
?.
Dispose
();
public
Issue898
()
{
mux
=
ConnectionMultiplexer
.
Connect
(
"localhost:6379"
);
db
=
mux
.
GetDatabase
();
}
const
int
max
=
100000
;
[
Benchmark
(
OperationsPerInvoke
=
max
)]
public
void
Load
()
{
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
db
.
StringSet
(
i
.
ToString
(),
i
);
}
}
[
Benchmark
(
OperationsPerInvoke
=
max
)]
public
async
Task
LoadAsync
()
{
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
await
db
.
StringSetAsync
(
i
.
ToString
(),
i
);
}
}
[
Benchmark
(
OperationsPerInvoke
=
max
)]
public
void
Sample
()
{
var
rnd
=
new
Random
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
var
r
=
rnd
.
Next
(
0
,
max
-
1
);
var
rv
=
db
.
StringGet
(
r
.
ToString
());
if
(
rv
!=
r
)
{
throw
new
Exception
(
$"Unexpected
{
rv
}
, expected
{
r
}
"
);
}
}
}
[
Benchmark
(
OperationsPerInvoke
=
max
)]
public
async
Task
SampleAsync
()
{
var
rnd
=
new
Random
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
var
r
=
rnd
.
Next
(
0
,
max
-
1
);
var
rv
=
await
db
.
StringGetAsync
(
r
.
ToString
());
if
(
rv
!=
r
)
{
throw
new
Exception
(
$"Unexpected
{
rv
}
, expected
{
r
}
"
);
}
}
}
}
}
BasicTestBaseline/BasicTestBaseline.csproj
View file @
f2e7109e
...
...
@@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.1
0.14
" />
<PackageReference Include="BenchmarkDotNet" Version="0.1
1.0
" />
</ItemGroup>
<ItemGroup>
...
...
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