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
5fbc511f
Unverified
Kaydet (Commit)
5fbc511f
authored
Nis 17, 2018
tarafından
INADA Naoki
Kaydeden (comit)
GitHub
Nis 17, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-33205: dict: Change GROWTH_RATE to `used*3` (GH-6350)
üst
acfb087f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
2018-04-03-00-58-41.bpo-33205.lk2F3r.rst
...ore and Builtins/2018-04-03-00-58-41.bpo-33205.lk2F3r.rst
+3
-0
dictobject.c
Objects/dictobject.c
+5
-6
No files found.
Misc/NEWS.d/next/Core and Builtins/2018-04-03-00-58-41.bpo-33205.lk2F3r.rst
0 → 100644
Dosyayı görüntüle @
5fbc511f
Change dict growth function from ``round_up_to_power_2(used*2+hashtable_size/2)`` to
``round_up_to_power_2(used*3)``. Previously, dict is shrinked only when ``used == 0``.
Now dict has more chance to be shrinked.
Objects/dictobject.c
Dosyayı görüntüle @
5fbc511f
...
@@ -396,17 +396,16 @@ dk_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
...
@@ -396,17 +396,16 @@ dk_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
*/
*/
/* GROWTH_RATE. Growth rate upon hitting maximum load.
/* GROWTH_RATE. Growth rate upon hitting maximum load.
* Currently set to used*
2 + capacity/2
.
* Currently set to used*
3
.
* This means that dicts double in size when growing without deletions,
* 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
* but have more head room when the number of deletions is on a par with the
* number of insertions.
* number of insertions. See also bpo-17563 and bpo-33205.
* 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.
* GROWTH_RATE was set to used*4 up to version 3.2.
* GROWTH_RATE was set to used*4 up to version 3.2.
* GROWTH_RATE was set to used*2 in version 3.3.0
* GROWTH_RATE was set to used*2 in version 3.3.0
* GROWTH_RATE was set to used*2 + capacity/2 in 3.4.0-3.6.0.
*/
*/
#define GROWTH_RATE(d) ((
(d)->ma_used*2)+((d)->ma_keys->dk_size>>1)
)
#define GROWTH_RATE(d) ((
d)->ma_used*3
)
#define ENSURE_ALLOWS_DELETIONS(d) \
#define ENSURE_ALLOWS_DELETIONS(d) \
if ((d)->ma_keys->dk_lookup == lookdict_unicode_nodummy) { \
if ((d)->ma_keys->dk_lookup == lookdict_unicode_nodummy) { \
...
...
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