Fredrik Lundh
06a69dd8ff
needforspeed: partition implementation, part two.
...
feel free to improve the documentation and the docstrings.
2006-05-26 08:54:28 +00:00
Fredrik Lundh
fe5bb7e6d9
needforspeed: partition for 8-bit strings. for some simple tests,
...
this is on par with a corresponding find, and nearly twice as fast
as split(sep, 1)
full tests, a unicode version, and documentation will follow to-
morrow.
2006-05-25 23:27:53 +00:00
Bob Ippolito
955b64c031
squelch gcc4 darwin/x86 compiler warnings
2006-05-25 20:52:38 +00:00
Fredrik Lundh
554da412a8
needforspeed: use insert+reverse instead of append
2006-05-25 19:19:05 +00:00
Jack Diederich
60cbb3fe49
* eliminate warning by reverting tmp_s type to 'const char*'
2006-05-25 18:47:15 +00:00
Fredrik Lundh
c3434b3834
needforspeed: use fastsearch also for find/index and contains. the
...
related tests are now about 10x faster.
2006-05-25 18:44:29 +00:00
Andrew Dalke
598710c727
Added overflow test for adding two (very) large strings where the
...
new string is over max Py_ssize_t. I have no way to test it on my
box or any box I have access to. At least it doesn't break anything.
2006-05-25 18:18:39 +00:00
Andrew M. Kuchling
f344c94c85
Comment typo
2006-05-25 18:11:16 +00:00
Fredrik Lundh
af72237abc
needforspeed: use "fastsearch" for count. this results in a 3x speedup
...
for the related stringbench tests.
2006-05-25 17:55:31 +00:00
Andrew Dalke
8c9091074b
Fixed problem identified by Georg. The special-case in-place code for replace
...
made a copy of the string using PyString_FromStringAndSize(s, n) and modify
the copied string in-place. However, 1 (and 0) character strings are shared
from a cache. This cause "A".replace("A", "a") to change the cached version
of "A" -- used by everyone.
Now may the copy with NULL as the string and do the memcpy manually. I've
added regression tests to check if this happens in the future. Perhaps
there should be a PyString_Copy for this case?
2006-05-25 17:53:00 +00:00
Fredrik Lundh
e68955cf32
needforspeed: new replace implementation by Andrew Dalke. replace is
...
now about 3x faster on my machine, for the replace tests from string-
bench.
2006-05-25 17:08:14 +00:00
Fredrik Lundh
0c71f88fc9
needforspeed: check for overflow in replace (from Andrew Dalke)
2006-05-25 16:46:54 +00:00
Fredrik Lundh
dfe503d3f0
needforspeed: _toupper/_tolower is a SUSv2 thing; fall back on ISO C
...
versions if they're not defined.
2006-05-25 16:10:12 +00:00
Fredrik Lundh
4b4e33ef14
needforspeed: make new upper/lower work properly for single-character
...
strings too... (thanks to georg brandl for spotting the exact problem
faster than anyone else)
2006-05-25 15:49:45 +00:00
Fredrik Lundh
39ccef607e
needforspeed: speed up upper and lower for 8-bit string objects.
...
(the unicode versions of these are still 2x faster on windows,
though...)
based on work by Andrew Dalke, with tweaks by yours truly.
2006-05-25 15:22:03 +00:00
Fredrik Lundh
763b50f9d9
docstring tweaks: count counts non-overlapping substrings, not
...
total number of occurences
2006-05-22 15:35:12 +00:00
Tim Peters
8931ff1f67
Teach PyString_FromFormat, PyErr_Format, and PyString_FromFormatV
...
about "%u", "%lu" and "%zu" formats.
Since PyString_FromFormat and PyErr_Format have exactly the same rules
(both inherited from PyString_FromFormatV), it would be good if someone
with more LaTeX Fu changed one of them to just point to the other.
Their docs were way out of synch before this patch, and I just did a
mass copy+paste to repair that.
Not a backport candidate (this is a new feature).
2006-05-13 23:28:20 +00:00
Martin v. Löwis
822f34a848
Revert 43315: Printing of %zd must be signed.
2006-05-13 13:34:04 +00:00
Thomas Wouters
568f1d0eed
Py_ssize_t issue; repr()'ing a very large string would result in a teensy
...
string, because of a cast to int.
2006-04-21 13:54:43 +00:00
Thomas Wouters
dc5f808cbc
Make s.replace() work with explicit counts exceeding 2Gb.
2006-04-19 15:38:01 +00:00
Thomas Wouters
4abb3660ca
Use Py_ssize_t to hold the 'width' argument to the ljust, rjust, center and
...
zfill stringmethods, so they can create strings larger than 2Gb on 64bit
systems (even win64.) The unicode versions of these methods already did this
right.
2006-04-19 14:50:15 +00:00
Skip Montanaro
429433b30b
C++ compiler cleanup: bunch-o-casts, plus use of unsigned loop index var in a couple places
2006-04-18 00:35:43 +00:00
Neal Norwitz
0e2cbabb8d
No need to cast a Py_ssize_t, use %z in PyErr_Format
2006-04-17 05:56:32 +00:00
Martin v. Löwis
5cb6936672
Make Py_BuildValue, PyObject_CallFunction and
...
PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
2006-04-14 09:08:42 +00:00
Martin v. Löwis
83687c98dc
Change more occurrences of maxsplit to Py_ssize_t.
2006-04-13 08:52:56 +00:00