Skip to content

Commit 68ad5f4

Browse files
committed
[skip ci] separate benchmark result file
1 parent 889ec5b commit 68ad5f4

File tree

2 files changed

+71
-74
lines changed

2 files changed

+71
-74
lines changed

benchmark/bench.jl

Lines changed: 25 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ using AcuteML, BenchmarkTools
22

33
# Type Definition
44

5-
@aml mutable struct Person "person", check_course
5+
@aml mutable struct Person
6+
"person", check_course
67
age::UInt64, "~"
78
field, "study-field"
89
GPA::Float64 = 4.5, "~", GPAcheck
910
courses::Vector{String}, "taken-courses"
1011
id::Int64, att"~"
1112
end
1213

13-
@aml mutable struct University doc"university"
14+
@aml mutable struct University
15+
doc"university"
1416
name, att"university-name"
1517
people::Vector{Person}, "person"
1618
end
@@ -34,11 +36,11 @@ end
3436
################################################################
3537
#Benchmark
3638
function creation()
37-
P1 = Person(age=24, field="Mechanical Engineering", courses=["Artificial Intelligence", "Robotics"], id = 1)
39+
P1 = Person(age = 24, field = "Mechanical Engineering", courses = ["Artificial Intelligence", "Robotics"], id = 1)
3840

39-
P2 = Person(age=18, field="Computer Engineering", GPA=4, courses=["Julia"], id = 2)
41+
P2 = Person(age = 18, field = "Computer Engineering", GPA = 4, courses = ["Julia"], id = 2)
4042

41-
U = University(name="Julia University", people=[P1, P2])
43+
U = University(name = "Julia University", people = [P1, P2])
4244

4345
return P1, P2, U
4446
end
@@ -47,29 +49,29 @@ function mutability(P1, P2, U)
4749
P1.age = UInt(22)
4850
# P1.courses = ["Artificial Intelligence", "Robotics", "Machine Design"]
4951

50-
P2.GPA=4.2 # mutability support
52+
P2.GPA = 4.2 # mutability support
5153
U.name = "MIT"
5254
return P1, P2, U
5355
end
5456

5557
function extraction()
56-
xml=parsexml("""
57-
<?xml version="1.0" encoding="UTF-8"?>
58-
<university university-name="MIT">
59-
<person id="1">
60-
<age>22</age>
61-
<study-field>Mechanical Engineering</study-field>
62-
<GPA>4.5</GPA>
63-
<taken-courses>Artificial Intelligence</taken-courses> <taken-courses>Robotics</taken-courses>
64-
</person>
65-
<person id="2">
66-
<age>18</age>
67-
<study-field>Computer Engineering</study-field>
68-
<GPA>4.2</GPA>
69-
<taken-courses>Julia</taken-courses>
70-
</person>
71-
</university>
72-
""")
58+
xml = parsexml("""
59+
<?xml version="1.0" encoding="UTF-8"?>
60+
<university university-name="MIT">
61+
<person id="1">
62+
<age>22</age>
63+
<study-field>Mechanical Engineering</study-field>
64+
<GPA>4.5</GPA>
65+
<taken-courses>Artificial Intelligence</taken-courses> <taken-courses>Robotics</taken-courses>
66+
</person>
67+
<person id="2">
68+
<age>18</age>
69+
<study-field>Computer Engineering</study-field>
70+
<GPA>4.2</GPA>
71+
<taken-courses>Julia</taken-courses>
72+
</person>
73+
</university>
74+
""")
7375
U = University(xml)
7476
end
7577

@@ -80,54 +82,3 @@ P1, P2, U = creation();
8082
@btime mutability($P1, $P2, $U);
8183

8284
@btime extraction();
83-
84-
#=
85-
Benchmark Result
86-
87-
v 0.10
88-
# small bump in extraction is because of two additional hasmethod check in nodeparse. Using traits this will be fixed
89-
90-
8.899 μs (100 allocations: 3.61 KiB)
91-
3.938 μs (66 allocations: 3.17 KiB)
92-
308.500 μs (403 allocations: 16.33 KiB)
93-
94-
V 0.9.2 - julia 1.4
95-
96-
10.000 μs (99 allocations: 3.39 KiB)
97-
3.986 μs (66 allocations: 3.17 KiB)
98-
281.099 μs (356 allocations: 14.53 KiB)
99-
100-
V 0.8.2
101-
102-
9.800 μs (100 allocations: 3.41 KiB)
103-
4.057 μs (66 allocations: 3.17 KiB)
104-
275.499 μs (356 allocations: 14.53 KiB)
105-
106-
-------------------------------------
107-
V 0.7
108-
109-
11.299 μs (108 allocations: 11.61 KiB)
110-
5.267 μs (73 allocations: 11.36 KiB)
111-
261.400 μs (371 allocations: 23.11 KiB)
112-
113-
-------------------------------------
114-
V 0.6
115-
9.099 μs (92 allocations: 11.34 KiB)
116-
16.800 μs (72 allocations: 11.58 KiB)
117-
474.400 μs (348 allocations: 22.61 KiB)
118-
119-
-------------------------------------
120-
V0.5
121-
9.200 μs (93 allocations: 11.36 KiB)
122-
19.799 μs (72 allocations: 11.58 KiB)
123-
489.401 μs (348 allocations: 22.61 KiB
124-
125-
-------------------------------------
126-
V 0.4
127-
128-
9.999 μs (92 allocations: 11.34 KiB)
129-
20.900 μs (72 allocations: 11.58 KiB)
130-
493.499 μs (363 allocations: 23.23 KiB)
131-
132-
133-
=#

benchmark/benchmark_result.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Benchmark Result
2+
3+
v 0.10
4+
small bump in extraction is because of two additional `hasmethod` check in `nodeparse`. Using traits this will be fixed
5+
6+
8.899 μs (100 allocations: 3.61 KiB)
7+
3.938 μs (66 allocations: 3.17 KiB)
8+
308.500 μs (403 allocations: 16.33 KiB)
9+
10+
V 0.9.2 - julia 1.4
11+
12+
10.000 μs (99 allocations: 3.39 KiB)
13+
3.986 μs (66 allocations: 3.17 KiB)
14+
281.099 μs (356 allocations: 14.53 KiB)
15+
16+
V 0.8.2
17+
18+
9.800 μs (100 allocations: 3.41 KiB)
19+
4.057 μs (66 allocations: 3.17 KiB)
20+
275.499 μs (356 allocations: 14.53 KiB)
21+
22+
-------------------------------------
23+
V 0.7
24+
25+
11.299 μs (108 allocations: 11.61 KiB)
26+
5.267 μs (73 allocations: 11.36 KiB)
27+
261.400 μs (371 allocations: 23.11 KiB)
28+
29+
-------------------------------------
30+
V 0.6
31+
9.099 μs (92 allocations: 11.34 KiB)
32+
16.800 μs (72 allocations: 11.58 KiB)
33+
474.400 μs (348 allocations: 22.61 KiB)
34+
35+
-------------------------------------
36+
V0.5
37+
9.200 μs (93 allocations: 11.36 KiB)
38+
19.799 μs (72 allocations: 11.58 KiB)
39+
489.401 μs (348 allocations: 22.61 KiB
40+
41+
-------------------------------------
42+
V 0.4
43+
44+
9.999 μs (92 allocations: 11.34 KiB)
45+
20.900 μs (72 allocations: 11.58 KiB)
46+
493.499 μs (363 allocations: 23.23 KiB)

0 commit comments

Comments
 (0)