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
Kirill Smelkov
cython
Commits
dbee7050
Commit
dbee7050
authored
Aug 21, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make compiler pipeline a bit nicer to profile.
parent
ba75e1df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
Cython/Compiler/Pipeline.py
Cython/Compiler/Pipeline.py
+17
-3
No files found.
Cython/Compiler/Pipeline.py
View file @
dbee7050
...
@@ -323,8 +323,15 @@ def insert_into_pipeline(pipeline, transform, before=None, after=None):
...
@@ -323,8 +323,15 @@ def insert_into_pipeline(pipeline, transform, before=None, after=None):
# Running a pipeline
# Running a pipeline
#
#
_pipeline_entry_points
=
{}
def
run_pipeline
(
pipeline
,
source
,
printtree
=
True
):
def
run_pipeline
(
pipeline
,
source
,
printtree
=
True
):
from
.Visitor
import
PrintTree
from
.Visitor
import
PrintTree
exec_ns
=
globals
().
copy
()
if
DebugFlags
.
debug_verbose_pipeline
else
None
def
run
(
phase
,
data
):
return
phase
(
data
)
error
=
None
error
=
None
data
=
source
data
=
source
...
@@ -332,12 +339,19 @@ def run_pipeline(pipeline, source, printtree=True):
...
@@ -332,12 +339,19 @@ def run_pipeline(pipeline, source, printtree=True):
try
:
try
:
for
phase
in
pipeline
:
for
phase
in
pipeline
:
if
phase
is
not
None
:
if
phase
is
not
None
:
if
not
printtree
and
isinstance
(
phase
,
PrintTree
):
continue
if
DebugFlags
.
debug_verbose_pipeline
:
if
DebugFlags
.
debug_verbose_pipeline
:
t
=
time
()
t
=
time
()
print
(
"Entering pipeline phase %r"
%
phase
)
print
(
"Entering pipeline phase %r"
%
phase
)
if
not
printtree
and
isinstance
(
phase
,
PrintTree
):
# create a new wrapper for each step to show the name in profiles
continue
phase_name
=
getattr
(
phase
,
'__name__'
,
type
(
phase
).
__name__
)
data
=
phase
(
data
)
try
:
run
=
_pipeline_entry_points
[
phase_name
]
except
KeyError
:
exec
(
"def %s(phase, data): return phase(data)"
%
phase_name
,
exec_ns
)
run
=
_pipeline_entry_points
[
phase_name
]
=
exec_ns
[
phase_name
]
data
=
run
(
phase
,
data
)
if
DebugFlags
.
debug_verbose_pipeline
:
if
DebugFlags
.
debug_verbose_pipeline
:
print
(
" %.3f seconds"
%
(
time
()
-
t
))
print
(
" %.3f seconds"
%
(
time
()
-
t
))
except
CompileError
as
err
:
except
CompileError
as
err
:
...
...
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