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
36f74aa7
Kaydet (Commit)
36f74aa7
authored
May 17, 2013
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17563: Fix dict resize performance regression.
üst
b37706f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
dictobject.c
Objects/dictobject.c
+11
-7
No files found.
Objects/dictobject.c
Dosyayı görüntüle @
36f74aa7
...
...
@@ -305,14 +305,18 @@ PyDict_Fini(void)
* #define USABLE_FRACTION(n) (((n) >> 1) + ((n) >> 2) - ((n) >> 3))
*/
/* GROWTH_RATE. Growth rate upon hitting maximum load. Currently set to *2.
* Raising this to *4 doubles memory consumption depending on the size of
/* GROWTH_RATE. Growth rate upon hitting maximum load.
* Currently set to used*2 + capacity/2.
* This means that dicts double in size when growing without deletions,
* but have more head room when the number of deletions is on a par with the
* number of insertions.
* Raising this to used*4 doubles memory consumption depending on the size of
* the dictionary, but results in half the number of resizes, less effort to
* resize
and better sparseness for some (but not all dict sizes)
.
*
Setting to *4 eliminates every other resize step
.
* GROWTH_RATE was set to
*4 up to version 3.2.
* resize.
*
GROWTH_RATE was set to used*4 up to version 3.2
.
* GROWTH_RATE was set to
used*2 in version 3.3.0
*/
#define GROWTH_RATE(
x) ((x) * 2
)
#define GROWTH_RATE(
d) (((d)->ma_used*2)+((d)->ma_keys->dk_size>>1)
)
#define ENSURE_ALLOWS_DELETIONS(d) \
if ((d)->ma_keys->dk_lookup == lookdict_unicode_nodummy) { \
...
...
@@ -790,7 +794,7 @@ find_empty_slot(PyDictObject *mp, PyObject *key, Py_hash_t hash,
static
int
insertion_resize
(
PyDictObject
*
mp
)
{
return
dictresize
(
mp
,
GROWTH_RATE
(
mp
->
ma_used
));
return
dictresize
(
mp
,
GROWTH_RATE
(
mp
));
}
/*
...
...
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