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
60b29961
Kaydet (Commit)
60b29961
authored
Ock 01, 2006
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed English in a comment; trimmed trailing whitespace;
no code changes.
üst
0cdc3d88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
dictobject.c
Objects/dictobject.c
+11
-11
No files found.
Objects/dictobject.c
Dosyayı görüntüle @
60b29961
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* Dictionary object implementation using a hash table */
/* Dictionary object implementation using a hash table */
/* The distribution includes a separate file, Objects/dictnotes.txt,
/* The distribution includes a separate file, Objects/dictnotes.txt,
describing explorations into dictionary design and optimization.
describing explorations into dictionary design and optimization.
It covers typical dictionary use patterns, the parameters for
It covers typical dictionary use patterns, the parameters for
tuning dictionaries, and several ideas for possible optimizations.
tuning dictionaries, and several ideas for possible optimizations.
*/
*/
...
@@ -519,10 +519,10 @@ PyDict_GetItem(PyObject *op, PyObject *key)
...
@@ -519,10 +519,10 @@ PyDict_GetItem(PyObject *op, PyObject *key)
}
}
/* CAUTION: PyDict_SetItem() must guarantee that it won't resize the
/* CAUTION: PyDict_SetItem() must guarantee that it won't resize the
* dictionary if it
i
s merely replacing the value for an existing key.
* dictionary if it
'
s merely replacing the value for an existing key.
* This
is means that it's safe to loop over a dictionary with
* This
means that it's safe to loop over a dictionary with PyDict_Next()
*
PyDict_Next() and occasionally replace a value -- but you can't
*
and occasionally replace a value -- but you can't insert new keys or
*
insert new keys or
remove them.
* remove them.
*/
*/
int
int
PyDict_SetItem
(
register
PyObject
*
op
,
PyObject
*
key
,
PyObject
*
value
)
PyDict_SetItem
(
register
PyObject
*
op
,
PyObject
*
key
,
PyObject
*
value
)
...
@@ -554,15 +554,15 @@ PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value)
...
@@ -554,15 +554,15 @@ PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value)
/* If we added a key, we can safely resize. Otherwise just return!
/* If we added a key, we can safely resize. Otherwise just return!
* If fill >= 2/3 size, adjust size. Normally, this doubles or
* If fill >= 2/3 size, adjust size. Normally, this doubles or
* quaduples the size, but it's also possible for the dict to shrink
* quaduples the size, but it's also possible for the dict to shrink
* (if ma_fill is much larger than ma_used, meaning a lot of dict
* (if ma_fill is much larger than ma_used, meaning a lot of dict
* keys have been * deleted).
* keys have been * deleted).
*
*
* Quadrupling the size improves average dictionary sparseness
* Quadrupling the size improves average dictionary sparseness
* (reducing collisions) at the cost of some memory and iteration
* (reducing collisions) at the cost of some memory and iteration
* speed (which loops over every possible entry). It also halves
* speed (which loops over every possible entry). It also halves
* the number of expensive resize operations in a growing dictionary.
* the number of expensive resize operations in a growing dictionary.
*
*
* Very large dictionaries (over 50K items) use doubling instead.
* Very large dictionaries (over 50K items) use doubling instead.
* This may help applications with severe memory constraints.
* This may help applications with severe memory constraints.
*/
*/
if
(
!
(
mp
->
ma_used
>
n_used
&&
mp
->
ma_fill
*
3
>=
(
mp
->
ma_mask
+
1
)
*
2
))
if
(
!
(
mp
->
ma_used
>
n_used
&&
mp
->
ma_fill
*
3
>=
(
mp
->
ma_mask
+
1
)
*
2
))
...
@@ -734,7 +734,7 @@ dict_dealloc(register dictobject *mp)
...
@@ -734,7 +734,7 @@ dict_dealloc(register dictobject *mp)
PyMem_DEL
(
mp
->
ma_table
);
PyMem_DEL
(
mp
->
ma_table
);
if
(
num_free_dicts
<
MAXFREEDICTS
&&
mp
->
ob_type
==
&
PyDict_Type
)
if
(
num_free_dicts
<
MAXFREEDICTS
&&
mp
->
ob_type
==
&
PyDict_Type
)
free_dicts
[
num_free_dicts
++
]
=
mp
;
free_dicts
[
num_free_dicts
++
]
=
mp
;
else
else
mp
->
ob_type
->
tp_free
((
PyObject
*
)
mp
);
mp
->
ob_type
->
tp_free
((
PyObject
*
)
mp
);
Py_TRASHCAN_SAFE_END
(
mp
)
Py_TRASHCAN_SAFE_END
(
mp
)
}
}
...
@@ -2251,7 +2251,7 @@ static PyObject *dictiter_iternextitem(dictiterobject *di)
...
@@ -2251,7 +2251,7 @@ static PyObject *dictiter_iternextitem(dictiterobject *di)
Py_DECREF
(
PyTuple_GET_ITEM
(
result
,
1
));
Py_DECREF
(
PyTuple_GET_ITEM
(
result
,
1
));
}
else
{
}
else
{
result
=
PyTuple_New
(
2
);
result
=
PyTuple_New
(
2
);
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
NULL
;
return
NULL
;
}
}
di
->
len
--
;
di
->
len
--
;
...
...
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