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
761f690a
Commit
761f690a
authored
May 08, 2014
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce number of temporary std::strings
Reduces fannkuch.py runtime on my machine from 25.5 secs to 16.5 secs.
parent
b8f40b57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+6
-3
src/runtime/types.cpp
src/runtime/types.cpp
+7
-3
No files found.
src/runtime/objmodel.cpp
View file @
761f690a
...
@@ -372,10 +372,13 @@ void HCBox::giveAttr(const std::string& attr, Box* val) {
...
@@ -372,10 +372,13 @@ void HCBox::giveAttr(const std::string& attr, Box* val) {
}
}
void
HCBox
::
setattr
(
const
std
::
string
&
attr
,
Box
*
val
,
SetattrRewriteArgs
*
rewrite_args
,
SetattrRewriteArgs2
*
rewrite_args2
)
{
void
HCBox
::
setattr
(
const
std
::
string
&
attr
,
Box
*
val
,
SetattrRewriteArgs
*
rewrite_args
,
SetattrRewriteArgs2
*
rewrite_args2
)
{
RELEASE_ASSERT
(
attr
!=
"None"
||
this
==
builtins_module
,
"can't assign to None"
);
static
const
std
::
string
none_str
(
"None"
);
static
const
std
::
string
getattr_str
(
"__getattr__"
);
static
const
std
::
string
getattribute_str
(
"__getattribute__"
);
bool
isgetattr
=
(
attr
==
"__getattr__"
||
attr
==
"__getattribute__"
);
RELEASE_ASSERT
(
attr
!=
none_str
||
this
==
builtins_module
,
"can't assign to None"
);
if
(
isgetattr
&&
this
->
cls
==
type_cls
)
{
if
((
this
->
cls
==
type_cls
)
&&
(
attr
==
getattr_str
||
attr
==
getattribute_str
))
{
// Will have to embed the clear in the IC, so just disable the patching for now:
// Will have to embed the clear in the IC, so just disable the patching for now:
rewrite_args
=
NULL
;
rewrite_args
=
NULL
;
rewrite_args2
=
NULL
;
rewrite_args2
=
NULL
;
...
...
src/runtime/types.cpp
View file @
761f690a
...
@@ -246,10 +246,14 @@ extern "C" {
...
@@ -246,10 +246,14 @@ extern "C" {
}
}
extern
"C"
Box
*
createSlice
(
Box
*
start
,
Box
*
stop
,
Box
*
step
)
{
extern
"C"
Box
*
createSlice
(
Box
*
start
,
Box
*
stop
,
Box
*
step
)
{
static
const
std
::
string
start_str
(
"start"
);
static
const
std
::
string
stop_str
(
"stop"
);
static
const
std
::
string
step_str
(
"step"
);
BoxedSlice
*
rtn
=
new
BoxedSlice
(
start
,
stop
,
step
);
BoxedSlice
*
rtn
=
new
BoxedSlice
(
start
,
stop
,
step
);
rtn
->
setattr
(
"start"
,
start
,
NULL
,
NULL
);
rtn
->
setattr
(
start_str
,
start
,
NULL
,
NULL
);
rtn
->
setattr
(
"stop"
,
stop
,
NULL
,
NULL
);
rtn
->
setattr
(
stop_str
,
stop
,
NULL
,
NULL
);
rtn
->
setattr
(
"step"
,
step
,
NULL
,
NULL
);
rtn
->
setattr
(
step_str
,
step
,
NULL
,
NULL
);
return
rtn
;
return
rtn
;
}
}
...
...
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