Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
da4109dc
Commit
da4109dc
authored
Nov 22, 2012
by
Tatuya Kamada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test: Use a variable size of leaves in HBTreeFolder2 performance test.
Also clean-up the comments.
parent
1ed91764
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
23 deletions
+16
-23
product/HBTreeFolder2/tests/testHBTreeFolder2.py
product/HBTreeFolder2/tests/testHBTreeFolder2.py
+16
-23
No files found.
product/HBTreeFolder2/tests/testHBTreeFolder2.py
View file @
da4109dc
...
@@ -240,8 +240,6 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
...
@@ -240,8 +240,6 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2
from Products.CMFDefault.File import File
from Products.CMFDefault.File import File
h_depth_1 = HBTreeFolder2()
h_depth_1 = HBTreeFolder2()
#from BTrees.OOBTree import OOBTree
#h_depth_1 = OOBTree()
for i in xrange(%d):
for i in xrange(%d):
id = str(i)
id = str(i)
h_depth_1[id] = File(id)
h_depth_1[id] = File(id)
...
@@ -250,57 +248,52 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
...
@@ -250,57 +248,52 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2
from Products.CMFDefault.File import File
from Products.CMFDefault.File import File
h_depth_2 = HBTreeFolder2()
h_depth_2 = HBTreeFolder2()
#from BTrees.OOBTree import OOBTree
for i in xrange(10):
#h_depth_2 = OOBTree()
for j in xrange(%d / 10):
for i in xrange(%d / 100):
id = "-".join(map(str, (i,j)))
for j in xrange(100):
id = "-".join(map(str,(i,j)))
h_depth_2[id] = File(id)
h_depth_2[id] = File(id)
"""
)
"""
)
init_3
=
dedent
(
"""
init_3
=
dedent
(
"""
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2
from Products.CMFDefault.File import File
from Products.CMFDefault.File import File
h_depth_3 = HBTreeFolder2()
h_depth_3 = HBTreeFolder2()
#from BTrees.OOBTree import OOBTree
for i in xrange(10):
#h_depth_3 = OOBTree()
for j in xrange(10):
for i in xrange(%d / (100 * 10)):
for k in xrange(%d / (10 * 10)):
for j in xrange(100):
for k in xrange(10):
id = "-".join(map(str, (i, j, k)))
id = "-".join(map(str, (i, j, k)))
h_depth_3[id] = File(id)
h_depth_3[id] = File(id)
"""
)
"""
)
N
=
1000
N
=
1000
# measure 100 times of each test
# measure 100 times of each test
with timeit()
t1
=
timeit
.
Timer
(
"h_depth_1['555']"
,
init_1
%
N
).
timeit
(
100
)
t1
=
timeit
.
Timer
(
"h_depth_1['555']"
,
init_1
%
N
).
timeit
(
100
)
t2
=
timeit
.
Timer
(
"h_depth_2['5-55']"
,
init_2
%
N
).
timeit
(
100
)
t2
=
timeit
.
Timer
(
"h_depth_2['5-55']"
,
init_2
%
N
).
timeit
(
100
)
t3
=
timeit
.
Timer
(
"h_depth_3['
0-5
5-5']"
,
init_3
%
N
).
timeit
(
100
)
t3
=
timeit
.
Timer
(
"h_depth_3['
5-
5-5']"
,
init_3
%
N
).
timeit
(
100
)
ZopeTestCase
.
_print
(
"
\
n
N = 1000
\
n
"
)
ZopeTestCase
.
_print
(
"
\
n
N = 1000
\
n
"
)
ZopeTestCase
.
_print
(
"L1=%s
\
t
L2=%s
\
t
L3=%s"
%
(
t1
,
t2
,
t3
))
ZopeTestCase
.
_print
(
"L1=%s
\
t
L2=%s
\
t
L3=%s"
%
(
t1
,
t2
,
t3
))
N
=
10000
# 10 times bigger than previous test
N
=
10000
# The N is 10 times larger than the previous measurement
# measure 100 times of each test
t2_1
=
timeit
.
Timer
(
"h_depth_1['5555']"
,
init_1
%
N
).
timeit
(
100
)
t2_1
=
timeit
.
Timer
(
"h_depth_1['5555']"
,
init_1
%
N
).
timeit
(
100
)
t2_2
=
timeit
.
Timer
(
"h_depth_2['5
5-
55']"
,
init_2
%
N
).
timeit
(
100
)
t2_2
=
timeit
.
Timer
(
"h_depth_2['5
-5
55']"
,
init_2
%
N
).
timeit
(
100
)
t2_3
=
timeit
.
Timer
(
"h_depth_3['5-5
5-
5']"
,
init_3
%
N
).
timeit
(
100
)
t2_3
=
timeit
.
Timer
(
"h_depth_3['5-5
-5
5']"
,
init_3
%
N
).
timeit
(
100
)
ZopeTestCase
.
_print
(
"
\
n
N = 10000
\
n
"
)
ZopeTestCase
.
_print
(
"
\
n
N = 10000
\
n
"
)
ZopeTestCase
.
_print
(
"L1'=%s
\
t
L2'=%s
\
t
L3'=%s"
%
(
t2_1
,
t2_2
,
t2_3
))
ZopeTestCase
.
_print
(
"L1'=%s
\
t
L2'=%s
\
t
L3'=%s"
%
(
t2_1
,
t2_2
,
t2_3
))
N
=
100000
#
10 times bigger than pevious tes
t
N
=
100000
#
The N is 10 times larger than the pevious measuremen
t
t3_1
=
timeit
.
Timer
(
"h_depth_1['22222']"
,
init_1
%
N
).
timeit
(
100
)
t3_1
=
timeit
.
Timer
(
"h_depth_1['22222']"
,
init_1
%
N
).
timeit
(
100
)
t3_2
=
timeit
.
Timer
(
"h_depth_2['2
22-
22']"
,
init_2
%
N
).
timeit
(
100
)
t3_2
=
timeit
.
Timer
(
"h_depth_2['2
-22
22']"
,
init_2
%
N
).
timeit
(
100
)
t3_3
=
timeit
.
Timer
(
"h_depth_3['2
2-22-
2']"
,
init_3
%
N
).
timeit
(
100
)
t3_3
=
timeit
.
Timer
(
"h_depth_3['2
-2-22
2']"
,
init_3
%
N
).
timeit
(
100
)
ZopeTestCase
.
_print
(
"
\
n
N = 100000
\
n
"
)
ZopeTestCase
.
_print
(
"
\
n
N = 100000
\
n
"
)
ZopeTestCase
.
_print
(
"L1''=%s
\
t
L2''=%s
\
t
L3''=%s"
%
(
t3_1
,
t3_2
,
t3_3
))
ZopeTestCase
.
_print
(
"L1''=%s
\
t
L2''=%s
\
t
L3''=%s"
%
(
t3_1
,
t3_2
,
t3_3
))
# These assert are should be True, but right now those are not passed
# These assert are should be True, but right now those are not passed
# assert
that L2 is faster than L1, because the bottom node is smaller
# assert
L2 is faster than L1, because the leaves are fewer than L1
self
.
assertTrue
(
t1
>
t2
)
self
.
assertTrue
(
t1
>
t2
)
self
.
assertTrue
(
t2_1
>
t2_2
)
self
.
assertTrue
(
t2_1
>
t2_2
)
self
.
assertTrue
(
t3_1
>
t3_2
)
self
.
assertTrue
(
t3_1
>
t3_2
)
# assert
that L3 is faster than L2, because the bottom node is smaller
# assert
L3 is faster than L2, because the leaves are fewer than L1
self
.
assertTrue
(
t2
>
t3
)
self
.
assertTrue
(
t2
>
t3
)
self
.
assertTrue
(
t2_2
>
t2_3
)
self
.
assertTrue
(
t2_2
>
t2_3
)
self
.
assertTrue
(
t3_2
>
t3_3
)
self
.
assertTrue
(
t3_2
>
t3_3
)
...
...
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