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
a885b47a
Commit
a885b47a
authored
Aug 26, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change two frequent GC alloc call sites to use malloc in order to increase perf
parent
f94a7ee3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
from_cpython/Modules/_sre.c
from_cpython/Modules/_sre.c
+6
-2
from_cpython/Python/dtoa.c
from_cpython/Python/dtoa.c
+6
-5
No files found.
from_cpython/Modules/_sre.c
View file @
a885b47a
...
...
@@ -1180,7 +1180,9 @@ entrance:
ctx
->
pattern
[
1
],
ctx
->
pattern
[
2
]));
/* install new repeat context */
ctx
->
u
.
rep
=
(
SRE_REPEAT
*
)
PyObject_MALLOC
(
sizeof
(
*
ctx
->
u
.
rep
));
// Pyston change: use malloc
// ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));
ctx
->
u
.
rep
=
(
SRE_REPEAT
*
)
malloc
(
sizeof
(
*
ctx
->
u
.
rep
));
if
(
!
ctx
->
u
.
rep
)
{
PyErr_NoMemory
();
RETURN_FAILURE
;
...
...
@@ -1194,7 +1196,9 @@ entrance:
state
->
ptr
=
ctx
->
ptr
;
DO_JUMP
(
JUMP_REPEAT
,
jump_repeat
,
ctx
->
pattern
+
ctx
->
pattern
[
0
]);
state
->
repeat
=
ctx
->
u
.
rep
->
prev
;
PyObject_FREE
(
ctx
->
u
.
rep
);
// Pyston change: use malloc
// PyObject_FREE(ctx->u.rep);
free
(
ctx
->
u
.
rep
);
if
(
ret
)
{
RETURN_ON_ERROR
(
ret
);
...
...
from_cpython/Python/dtoa.c
View file @
a885b47a
...
...
@@ -118,17 +118,18 @@
#include "Python.h"
// Pyston change: disable custom memory managment because it confuses our GC
#define Py_USING_MEMORY_DEBUGGER 1
/* if PY_NO_SHORT_FLOAT_REPR is defined, then don't even try to compile
the following code */
#ifndef PY_NO_SHORT_FLOAT_REPR
#include "float.h"
#define MALLOC PyMem_Malloc
#define FREE PyMem_Free
// Pyston change: use normal malloc allocator because it's faster and we can't use the GC
// because the custom memory managment functions inside this file are not compatible with it.
// #define MALLOC PyMem_Malloc
// #define FREE PyMem_Free
#define MALLOC malloc
#define FREE free
/* This code should also work for ARM mixed-endian format on little-endian
machines, where doubles have byte order 45670123 (in increasing address
...
...
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