[New-bugs-announce] [issue26249] Change PyMem_Malloc to use PyObject_Malloc allocator?

STINNER Victor report at bugs.python.org
Sun Jan 31 12:48:24 EST 2016


New submission from STINNER Victor:

The issue #23601 showed speedup for the dict type by replacing PyMem_Malloc() with PyObject_Malloc() in dictobject.c.

When I worked on the PEP 445, it was discussed to use the Python fast memory allocator for small memory allocations (<= 512 bytes), but I think that nobody tested on benchmark.

So I open an issue to discuss that.

By the way, we should also benchmark the Windows memory allocator which limits fragmentations. Maybe we can skip the Python small memory allocator on recent version of Windows?

Attached patch implements the change. The main question is the speedup on various kinds of memory allocations (need a benchmark) :-)

I will try to run benchmarks.

--

If the patch slows down Python, maybe we can investigate if some Python types (like dict) mostly uses "small" memory blocks (<= 512 bytes).

----------
files: pymem.patch
keywords: patch
messages: 259290
nosy: haypo, rhettinger, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Change PyMem_Malloc to use PyObject_Malloc allocator?
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file41767/pymem.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26249>
_______________________________________


More information about the New-bugs-announce mailing list