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
5aed5b77
Commit
5aed5b77
authored
Jun 17, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize creating tuples from lists
parent
77b84b6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
microbenchmarks/sre_optimize_unicode.py
microbenchmarks/sre_optimize_unicode.py
+11
-0
microbenchmarks/tuple_ubench.py
microbenchmarks/tuple_ubench.py
+4
-0
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+9
-0
No files found.
microbenchmarks/sre_optimize_unicode.py
0 → 100644
View file @
5aed5b77
import
sre_compile
import
sre_constants
def
identity
(
o
):
return
o
charset
=
[(
sre_constants
.
RANGE
,
(
128
,
65535
))]
for
i
in
xrange
(
100
):
sre_compile
.
_optimize_unicode
(
charset
,
identity
)
# print sre_compile._optimize_charset(charset, identity)
microbenchmarks/tuple_ubench.py
0 → 100644
View file @
5aed5b77
l
=
range
(
256
)
for
i
in
xrange
(
200000
):
tuple
(
l
)
src/runtime/tuple.cpp
View file @
5aed5b77
...
...
@@ -286,6 +286,15 @@ extern "C" Box* tupleNew(Box* _cls, BoxedTuple* args, BoxedDict* kwargs) {
raiseExcHelper
(
TypeError
,
"'%s' is an invalid keyword argument for this function"
,
kw
->
data
());
}
if
(
cls
==
tuple_cls
)
{
// Call PySequence_Tuple since it has some perf special-cases
// that can make it quite a bit faster than the generic pyElements iteration:
Box
*
r
=
PySequence_Tuple
(
elements
);
if
(
!
r
)
throwCAPIException
();
return
r
;
}
std
::
vector
<
Box
*
,
StlCompatAllocator
<
Box
*>>
elts
;
for
(
auto
e
:
elements
->
pyElements
())
elts
.
push_back
(
e
);
...
...
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