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
4560f9c6
Kaydet (Commit)
4560f9c6
authored
Nis 14, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
PyUnicode_Join(): move use_memcpy test out of the loop to cleanup and optimize the code
üst
55c08781
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
20 deletions
+28
-20
unicodeobject.c
Objects/unicodeobject.c
+28
-20
No files found.
Objects/unicodeobject.c
Dosyayı görüntüle @
4560f9c6
...
@@ -9466,41 +9466,49 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
...
@@ -9466,41 +9466,49 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
sep_data = PyUnicode_1BYTE_DATA(sep);
sep_data = PyUnicode_1BYTE_DATA(sep);
}
}
#endif
#endif
for (i = 0, res_offset = 0; i < seqlen; ++i) {
if (use_memcpy) {
Py_ssize_t itemlen;
for (i = 0; i < seqlen; ++i) {
item = items[i];
Py_ssize_t itemlen;
/* Copy item, and maybe the separator. */
item = items[i];
if (i && seplen != 0) {
if (use_memcpy) {
/* Copy item, and maybe the separator. */
if (i && seplen != 0) {
Py_MEMCPY(res_data,
Py_MEMCPY(res_data,
sep_data,
sep_data,
kind * seplen);
kind * seplen);
res_data += kind * seplen;
res_data += kind * seplen;
}
}
else {
_PyUnicode_FastCopyCharacters(res, res_offset, sep, 0, seplen);
itemlen = PyUnicode_GET_LENGTH(item);
res_offset += seplen;
if (itemlen != 0) {
}
}
itemlen = PyUnicode_GET_LENGTH(item);
if (itemlen != 0) {
if (use_memcpy) {
Py_MEMCPY(res_data,
Py_MEMCPY(res_data,
PyUnicode_DATA(item),
PyUnicode_DATA(item),
kind * itemlen);
kind * itemlen);
res_data += kind * itemlen;
res_data += kind * itemlen;
}
}
else {
}
assert(res_data == PyUnicode_1BYTE_DATA(res)
+ kind * PyUnicode_GET_LENGTH(res));
}
else {
for (i = 0, res_offset = 0; i < seqlen; ++i) {
Py_ssize_t itemlen;
item = items[i];
/* Copy item, and maybe the separator. */
if (i && seplen != 0) {
_PyUnicode_FastCopyCharacters(res, res_offset, sep, 0, seplen);
res_offset += seplen;
}
itemlen = PyUnicode_GET_LENGTH(item);
if (itemlen != 0) {
_PyUnicode_FastCopyCharacters(res, res_offset, item, 0, itemlen);
_PyUnicode_FastCopyCharacters(res, res_offset, item, 0, itemlen);
res_offset += itemlen;
res_offset += itemlen;
}
}
}
}
}
if (use_memcpy)
assert(res_data == PyUnicode_1BYTE_DATA(res)
+ kind * PyUnicode_GET_LENGTH(res));
else
assert(res_offset == PyUnicode_GET_LENGTH(res));
assert(res_offset == PyUnicode_GET_LENGTH(res));
}
Py_DECREF(fseq);
Py_DECREF(fseq);
Py_XDECREF(sep);
Py_XDECREF(sep);
...
...
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