Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
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
Dapper
Commits
82a00595
Commit
82a00595
authored
Nov 02, 2018
by
Maksim Karpenko
Committed by
Nick Craver
Nov 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the eXpress Persistent Objects (XPO) benchmark (#1131)
parent
ec194429
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
0 deletions
+113
-0
Benchmarks.XPO.cs
Dapper.Tests.Performance/Benchmarks.XPO.cs
+60
-0
Dapper.Tests.Performance.csproj
Dapper.Tests.Performance/Dapper.Tests.Performance.csproj
+1
-0
LegacyTests.cs
Dapper.Tests.Performance/LegacyTests.cs
+27
-0
Post.cs
Dapper.Tests.Performance/XPO/Post.cs
+25
-0
No files found.
Dapper.Tests.Performance/Benchmarks.XPO.cs
0 → 100644
View file @
82a00595
using
BenchmarkDotNet.Attributes
;
using
System
;
using
System.Linq
;
using
System.ComponentModel
;
using
DevExpress.Xpo
;
using
DevExpress.Data.Filtering
;
namespace
Dapper.Tests.Performance
{
[
Description
(
"DevExpress.XPO"
)]
public
class
XpoBenchmarks
:
BenchmarkBase
{
public
UnitOfWork
_session
;
[
GlobalSetup
]
public
void
Setup
()
{
BaseSetup
();
IDataLayer
dataLayer
=
XpoDefault
.
GetDataLayer
(
_connection
,
DevExpress
.
Xpo
.
DB
.
AutoCreateOption
.
SchemaAlreadyExists
);
dataLayer
.
Dictionary
.
GetDataStoreSchema
(
typeof
(
Xpo
.
Post
));
_session
=
new
UnitOfWork
(
dataLayer
,
dataLayer
);
_session
.
IdentityMapBehavior
=
IdentityMapBehavior
.
Strong
;
_session
.
TypesManager
.
EnsureIsTypedObjectValid
();
}
[
GlobalCleanup
]
public
void
Cleanup
()
{
_session
.
Dispose
();
}
[
Benchmark
(
Description
=
"GetObjectByKey<T>"
)]
public
Xpo
.
Post
GetObjectByKey
()
{
Step
();
return
_session
.
GetObjectByKey
<
Xpo
.
Post
>(
i
,
true
);
}
[
Benchmark
(
Description
=
"FindObject<T>"
)]
public
Xpo
.
Post
FindObject
()
{
Step
();
CriteriaOperator
_findCriteria
=
new
BinaryOperator
()
{
OperatorType
=
BinaryOperatorType
.
Equal
,
LeftOperand
=
new
OperandProperty
(
"Id"
),
RightOperand
=
new
ConstantValue
(
i
)
};
return
_session
.
FindObject
<
Xpo
.
Post
>(
_findCriteria
);
}
[
Benchmark
(
Description
=
"Query<T>"
)]
public
Xpo
.
Post
Query
()
{
Step
();
return
_session
.
Query
<
Xpo
.
Post
>().
First
(
p
=>
p
.
Id
==
i
);
}
}
}
Dapper.Tests.Performance/Dapper.Tests.Performance.csproj
View file @
82a00595
...
...
@@ -16,6 +16,7 @@
<PackageReference Include="Dashing.Weaver" Version="2.0.7" />
<PackageReference Include="Belgrade.Sql.Client" Version="1.1.4" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.1" />
<PackageReference Include="DevExpress.Xpo" Version="18.1.6" />
<!--<PackageReference Include="BLToolkit" Version="4.3.6" />-->
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="6.3.0" />
...
...
Dapper.Tests.Performance/LegacyTests.cs
View file @
82a00595
...
...
@@ -24,6 +24,9 @@
using
Dashing
;
using
Microsoft.EntityFrameworkCore
;
using
Belgrade.SqlClient
;
using
DevExpress.Xpo
;
using
Dapper.Tests.Performance.Xpo
;
using
DevExpress.Data.Filtering
;
namespace
Dapper.Tests.Performance
{
...
...
@@ -386,6 +389,30 @@ public async Task RunAsync(int iterations)
#endif
},
"Hand Coded"
);
// DevExpress.XPO
Try
(()
=>
{
IDataLayer
dataLayer
=
XpoDefault
.
GetDataLayer
(
connection
,
DevExpress
.
Xpo
.
DB
.
AutoCreateOption
.
SchemaAlreadyExists
);
dataLayer
.
Dictionary
.
GetDataStoreSchema
(
typeof
(
Xpo
.
Post
));
UnitOfWork
session
=
new
UnitOfWork
(
dataLayer
,
dataLayer
);
session
.
IdentityMapBehavior
=
IdentityMapBehavior
.
Strong
;
session
.
TypesManager
.
EnsureIsTypedObjectValid
();
tests
.
Add
(
id
=>
session
.
Query
<
Xpo
.
Post
>().
First
(
p
=>
p
.
Id
==
id
),
"DevExpress.XPO: Query<T>"
);
tests
.
Add
(
id
=>
session
.
GetObjectByKey
<
Xpo
.
Post
>(
id
,
true
),
"DevExpress.XPO: GetObjectByKey<T>"
);
tests
.
Add
(
id
=>
{
CriteriaOperator
findCriteria
=
new
BinaryOperator
()
{
OperatorType
=
BinaryOperatorType
.
Equal
,
LeftOperand
=
new
OperandProperty
(
"Id"
),
RightOperand
=
new
ConstantValue
(
id
)
};
session
.
FindObject
<
Xpo
.
Post
>(
findCriteria
);
},
"DevExpress.XPO: FindObject<T>"
);
},
"DevExpress.XPO"
);
// Subsonic isn't maintained anymore - doesn't import correctly
//Try(() =>
// {
...
...
Dapper.Tests.Performance/XPO/Post.cs
0 → 100644
View file @
82a00595
using
System
;
using
DevExpress.Xpo
;
namespace
Dapper.Tests.Performance.Xpo
{
[
Persistent
(
"Posts"
)]
public
class
Post
:
XPLiteObject
{
[
Key
(
false
)]
public
int
Id
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
public
DateTime
CreationDate
{
get
;
set
;
}
public
DateTime
LastChangeDate
{
get
;
set
;
}
public
int
?
Counter1
{
get
;
set
;
}
public
int
?
Counter2
{
get
;
set
;
}
public
int
?
Counter3
{
get
;
set
;
}
public
int
?
Counter4
{
get
;
set
;
}
public
int
?
Counter5
{
get
;
set
;
}
public
int
?
Counter6
{
get
;
set
;
}
public
int
?
Counter7
{
get
;
set
;
}
public
int
?
Counter8
{
get
;
set
;
}
public
int
?
Counter9
{
get
;
set
;
}
public
Post
(
Session
session
)
:
base
(
session
)
{
}
}
}
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