Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2bc4d95b
Kaydet (Commit)
2bc4d95b
authored
Haz 02, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21233: Revert bytearray(int) optimization using calloc()
üst
d8f0d922
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
21 deletions
+7
-21
3.5.rst
Doc/whatsnew/3.5.rst
+2
-3
NEWS
Misc/NEWS
+3
-4
bytearrayobject.c
Objects/bytearrayobject.c
+2
-14
No files found.
Doc/whatsnew/3.5.rst
Dosyayı görüntüle @
2bc4d95b
...
@@ -196,9 +196,8 @@ Optimizations
...
@@ -196,9 +196,8 @@ Optimizations
The following performance enhancements have been added:
The following performance enhancements have been added:
* Construction of ``bytes(int)`` and ``bytearray(int)`` (filled by zero bytes)
* Construction of ``bytes(int)`` (filled by zero bytes) is faster and use less
is faster and use less memory (until the bytearray buffer is filled with
memory for large objects. ``calloc()`` is used instead of ``malloc()`` to
data) for large objects. ``calloc()`` is used instead of ``malloc()`` to
allocate memory for these objects.
allocate memory for these objects.
* Some operations on :class:`~ipaddress.IPv4Network` and
* Some operations on :class:`~ipaddress.IPv4Network` and
...
...
Misc/NEWS
Dosyayı görüntüle @
2bc4d95b
...
@@ -26,10 +26,9 @@ Core and Builtins
...
@@ -26,10 +26,9 @@ Core and Builtins
internal iteration logic.
internal iteration logic.
- Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
- Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int)
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) is now using
are now using ``calloc()`` instead of ``malloc()`` for large objects which
``calloc()`` instead of ``malloc()`` for large objects which is faster and
is faster and use less memory (until the bytearray buffer is filled with
use less memory.
data).
- Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the
- Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the
first argument has a reference count of 1. Patch by Nikolaus Rath.
first argument has a reference count of 1. Patch by Nikolaus Rath.
...
...
Objects/bytearrayobject.c
Dosyayı görüntüle @
2bc4d95b
...
@@ -813,21 +813,9 @@ bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
...
@@ -813,21 +813,9 @@ bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
}
}
else
{
else
{
if
(
count
>
0
)
{
if
(
count
>
0
)
{
void
*
sval
;
if
(
PyByteArray_Resize
((
PyObject
*
)
self
,
count
))
Py_ssize_t
alloc
;
assert
(
Py_SIZE
(
self
)
==
0
);
alloc
=
count
+
1
;
sval
=
PyObject_Calloc
(
1
,
alloc
);
if
(
sval
==
NULL
)
return
-
1
;
return
-
1
;
memset
(
PyByteArray_AS_STRING
(
self
),
0
,
count
);
PyObject_Free
(
self
->
ob_bytes
);
self
->
ob_bytes
=
self
->
ob_start
=
sval
;
Py_SIZE
(
self
)
=
count
;
self
->
ob_alloc
=
alloc
;
}
}
return
0
;
return
0
;
}
}
...
...
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