Commit a885b47a authored by Marius Wachtler's avatar Marius Wachtler

Change two frequent GC alloc call sites to use malloc in order to increase perf

parent f94a7ee3
......@@ -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);
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment