Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
d498e5ca
Commit
d498e5ca
authored
Apr 17, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change up this test to be somewhat less random
parent
7f4f7fa6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
microbenchmarks/polymorphism.py
microbenchmarks/polymorphism.py
+33
-2
No files found.
microbenchmarks/polymorphism.py
View file @
d498e5ca
...
@@ -32,7 +32,38 @@ def make_random(x):
...
@@ -32,7 +32,38 @@ def make_random(x):
return
Simple
()
return
Simple
()
if
rand
()
<
0.3
:
if
rand
()
<
0.3
:
return
Union
([
make_random
(
0.5
*
x
-
1
),
make_random
(
0.5
*
x
-
1
)])
return
Union
([
make_random
(
0.5
*
(
x
-
1
)),
make_random
(
0.5
*
(
x
-
1
)
)])
return
Poly1
(
make_random
(
x
-
1
))
return
Poly1
(
make_random
(
x
-
1
))
print
make_random
(
100000
).
score
()
# Create a 10k-ary tree, and score it 1k times
r
=
make_random
(
10000
)
for
i
in
xrange
(
1000
):
r
.
score
()
# Other test configurations that can be run:
# Test 1: one 100k-ary tree:
# make_random(100000).score()
# Test 2: 1k 1k-ary trees:
# for i in xrange(1000):
# make_random(1000).score()
# Test 3: one 1k-ary tree, 1k times:
# r = make_random(1000)
# for i in xrange(1000):
# r.score()
# Test 4: 10k 100-ary trees:
# for i in xrange(10000):
# make_random(100).score()
# Test 5: one 100-ary tree, 10k times::
# r = make_random(100)
# for i in xrange(10000):
# r.score()
# Test 6: 100k 10-ary trees:
# for i in xrange(100000):
# make_random(10).score()
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