Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
query-conversion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
query-conversion
Commits
56e6fe34
Commit
56e6fe34
authored
3 years ago
by
thijsheijden
Browse files
Options
Downloads
Patches
Plain Diff
Added benchmarks
parent
589da230
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
convertQueryBenchmark_test.go
+152
-0
152 additions, 0 deletions
convertQueryBenchmark_test.go
with
152 additions
and
0 deletions
convertQueryBenchmark_test.go
0 → 100644
+
152
−
0
View file @
56e6fe34
package
aql
import
"testing"
func
BenchmarkConvertEmptyQuery
(
b
*
testing
.
B
)
{
// Setup for test
// Create query conversion service
service
:=
NewService
()
query
:=
[]
byte
(
`{
"return": {
"entities": [],
"relations": []
},
"entities": [],
"relations": [],
"limit": 5000
}`
)
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
service
.
ConvertQuery
(
&
query
)
}
}
func
BenchmarkConvertOneAttributeQuery
(
b
*
testing
.
B
)
{
// Setup for test
// Create query conversion service
service
:=
NewService
()
query
:=
[]
byte
(
`{
"return": {
"entities": [
0
],
"relations": []
},
"entities": [
{
"type": "airports",
"constraints": [
{
"attribute": "state",
"value": "HI",
"dataType": "text",
"matchType": "exact"
}
]
}
],
"relations": [],
"limit": 5000
}`
)
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
service
.
ConvertQuery
(
&
query
)
}
}
func
BenchmarkConvertTwoRelationQuery
(
b
*
testing
.
B
)
{
// Setup for test
// Create query conversion service
service
:=
NewService
()
query
:=
[]
byte
(
`{
"return": {
"entities": [
0,
1,
2
],
"relations": [
0,
1
]
},
"entities": [
{
"type": "airports",
"constraints": [
{
"attribute": "city",
"value": "New York",
"dataType": "text",
"matchType": "exact"
}
]
},
{
"type": "airports",
"constraints": [
{
"attribute": "city",
"value": "San Francisco",
"dataType": "text",
"matchType": "exact"
}
]
},
{
"type": "airports",
"constraints": [
{
"attribute": "state",
"value": "HI",
"dataType": "text",
"matchType": "exact"
}
]
}
],
"relations": [
{
"type": "flights",
"depth": {
"min": 1,
"max": 3
},
"entityFrom": 2,
"entityTo": 1,
"constraints": [
{
"attribute": "Day",
"value": "15",
"dataType": "number",
"matchType": "EQ"
}
]
},
{
"type": "flights",
"depth": {
"min": 1,
"max": 1
},
"entityFrom": 0,
"entityTo": -1,
"constraints": []
}
],
"limit": 5000
}`
)
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
service
.
ConvertQuery
(
&
query
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment