Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
83781ad5
Commit
83781ad5
authored
Nov 28, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix final optimisations for calls inside of assignments
parent
3f83a9b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+7
-0
No files found.
Cython/Compiler/Optimize.py
View file @
83781ad5
...
@@ -350,6 +350,10 @@ class FinalOptimizePhase(Visitor.CythonTransform):
...
@@ -350,6 +350,10 @@ class FinalOptimizePhase(Visitor.CythonTransform):
- isinstance -> typecheck for cdef types
- isinstance -> typecheck for cdef types
"""
"""
def
visit_SingleAssignmentNode
(
self
,
node
):
def
visit_SingleAssignmentNode
(
self
,
node
):
"""Avoid redundant initialisation of local variables before their
first assignment.
"""
self
.
visitchildren
(
node
)
if
node
.
first
:
if
node
.
first
:
lhs
=
node
.
lhs
lhs
=
node
.
lhs
lhs
.
lhs_of_first_assignment
=
True
lhs
.
lhs_of_first_assignment
=
True
...
@@ -360,6 +364,9 @@ class FinalOptimizePhase(Visitor.CythonTransform):
...
@@ -360,6 +364,9 @@ class FinalOptimizePhase(Visitor.CythonTransform):
return
node
return
node
def
visit_SimpleCallNode
(
self
,
node
):
def
visit_SimpleCallNode
(
self
,
node
):
"""Replace generic calls to isinstance(x, type) by a more efficient
type check.
"""
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
if
node
.
function
.
type
.
is_cfunction
and
isinstance
(
node
.
function
,
ExprNodes
.
NameNode
):
if
node
.
function
.
type
.
is_cfunction
and
isinstance
(
node
.
function
,
ExprNodes
.
NameNode
):
if
node
.
function
.
name
==
'isinstance'
:
if
node
.
function
.
name
==
'isinstance'
:
...
...
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