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
e4c7e9f2
Commit
e4c7e9f2
authored
Mar 21, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid formatting call overhead for simple Unicode value case
parent
ccd84b10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+8
-1
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+1
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
e4c7e9f2
...
...
@@ -3024,8 +3024,15 @@ class FormattedValueNode(ExprNode):
))
code
.
put_gotref
(
conversion_result
)
code
.
put
(
"%s = PyObject_Format(%s, %s); "
%
(
if
isinstance
(
self
.
format_spec
,
UnicodeNode
)
and
not
self
.
format_spec
.
value
:
# common case: no format spec => expect Unicode pass-through
format_func
=
'__Pyx_PyObject_FormatSimple'
else
:
format_func
=
'PyObject_Format'
code
.
put
(
"%s = %s(%s, %s); "
%
(
self
.
result
(),
format_func
,
conversion_result
,
self
.
format_spec
.
py_result
()))
...
...
Cython/Utility/ModuleSetupCode.c
View file @
e4c7e9f2
...
...
@@ -123,6 +123,7 @@
#define PyObject_Realloc(p) PyMem_Realloc(p)
#endif
#define __Pyx_PyObject_FormatSimple(s, f) (likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) : PyObject_Format(s, f))
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
...
...
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