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
df7fc9dd
Kaydet (Commit)
df7fc9dd
authored
Agu 19, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12778: Reduce memory consumption when JSON-encoding a large container of many small objects.
üst
9bb6dfe0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
test_dump.py
Lib/test/json_tests/test_dump.py
+18
-1
NEWS
Misc/NEWS
+3
-0
_json.c
Modules/_json.c
+0
-0
No files found.
Lib/test/json_tests/test_dump.py
Dosyayı görüntüle @
df7fc9dd
from
io
import
StringIO
from
test.json_tests
import
PyTest
,
CTest
from
test.support
import
precisionbigmemtest
,
_1G
class
TestDump
:
def
test_dump
(
self
):
...
...
@@ -21,4 +22,20 @@ class TestDump:
class
TestPyDump
(
TestDump
,
PyTest
):
pass
class
TestCDump
(
TestDump
,
CTest
):
pass
class
TestCDump
(
TestDump
,
CTest
):
# The size requirement here is hopefully over-estimated (actual
# memory consumption depending on implementation details, and also
# system memory management, since this may allocate a lot of
# small objects).
@precisionbigmemtest
(
size
=
_1G
,
memuse
=
1
)
def
test_large_list
(
self
,
size
):
N
=
int
(
30
*
1024
*
1024
*
(
size
/
_1G
))
l
=
[
1
]
*
N
encoded
=
self
.
dumps
(
l
)
self
.
assertEqual
(
len
(
encoded
),
N
*
3
)
self
.
assertEqual
(
encoded
[:
1
],
"["
)
self
.
assertEqual
(
encoded
[
-
2
:],
"1]"
)
self
.
assertEqual
(
encoded
[
1
:
-
2
],
"1, "
*
(
N
-
1
))
Misc/NEWS
Dosyayı görüntüle @
df7fc9dd
...
...
@@ -262,6 +262,9 @@ Core and Builtins
Library
-------
- Issue #12778: Reduce memory consumption when JSON-encoding a large
container of many small objects.
- Issue #12650: Fix a race condition where a subprocess.Popen could leak
resources (FD/zombie) when killed at the wrong time.
...
...
Modules/_json.c
Dosyayı görüntüle @
df7fc9dd
This diff is collapsed.
Click to expand it.
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