Commit graph

34667 commits

Author SHA1 Message Date
Bob Ippolito
aa70a17e13 enable all of the struct tests, use ssize_t, fix some whitespace 2006-05-26 20:25:23 +00:00
Andrew Dalke
5132407868 Added limits to the replace code so it does not count all of the matching
patterns in a string, only the number needed by the max limit.
2006-05-26 20:25:22 +00:00
Georg Brandl
e4e023c4d3 Simplify calling. 2006-05-26 20:22:50 +00:00
Georg Brandl
a89dbec257 Patch #1492218: document None being a constant. 2006-05-26 20:14:47 +00:00
Georg Brandl
7784f12d74 Replace Py_BuildValue("OO") by PyTuple_Pack. 2006-05-26 20:04:44 +00:00
Andrew M. Kuchling
07bbfc6a51 Comment typo 2006-05-26 19:51:10 +00:00
Fredrik Lundh
e6e43c867d needforspeed: stringlib refactoring: use stringlib/find for string find 2006-05-26 19:48:07 +00:00
Thomas Heller
cc7570fd90 Write more docs. 2006-05-26 19:43:45 +00:00
Fredrik Lundh
c816281304 needforspeed: use a macro to fix slice indexes 2006-05-26 19:33:03 +00:00
Fredrik Lundh
ce4eccb0c4 needforspeed: stringlib refactoring: use stringlib/find for unicode
find
2006-05-26 19:29:05 +00:00
Fredrik Lundh
58b5e84d52 needforspeed: stringlib refactoring, continued. added count and
find helpers; updated unicodeobject to use stringlib_count
2006-05-26 19:24:53 +00:00
Fredrik Lundh
a26de2a80f added rpartition method to UserString class 2006-05-26 19:23:21 +00:00
Georg Brandl
e001816dff Exception isn't the root of all exception classes anymore. 2006-05-26 19:04:47 +00:00
Brett Cannon
04f031d202 Change C spacing to 4 spaces by default to match PEP 7 for new C files. 2006-05-26 19:04:47 +00:00
Andrew Dalke
c5da53ba78 substring split now uses /F's fast string matching algorithm.
(If compiled without FAST search support, changed the pre-memcmp test
   to check the last character as well as the first.  This gave a 25%
   speedup for my test case.)

Rewrote the split algorithms so they stop when maxsplit gets to 0.
Previously they did a string match first then checked if the maxsplit
was reached.  The new way prevents a needless string search.
2006-05-26 19:02:09 +00:00
Andrew M. Kuchling
afe6598732 Add rpartition() and path caching 2006-05-26 18:41:18 +00:00
Steve Holden
d05e546850 Revert tests to MAL's original round sizes to retiain comparability
from long ago and far away. Stop calling this pybench 1.4 because it
isn't. Remove the empty test, which was a bad idea.
2006-05-26 18:26:21 +00:00
Fredrik Lundh
9c0e9c089c needspeed: rpartition documentation, tests, and a bug fixes.
feel free to add more tests and improve the documentation.
2006-05-26 18:24:15 +00:00
Fredrik Lundh
b3167cbcd7 needforspeed: added rpartition implementation 2006-05-26 18:15:38 +00:00
Fredrik Lundh
be9f219e40 removed unnecessary include 2006-05-26 18:05:34 +00:00
Georg Brandl
f4ef11659c Need for speed: Patch #921466 : sys.path_importer_cache is now used to cache valid and
invalid file paths for the built-in import machinery which leads to
  fewer open calls on startup.

  Also fix issue with PEP 302 style import hooks which lead to more open()
  calls than necessary.
2006-05-26 18:03:31 +00:00
Thomas Heller
2d6c5a868a Reordered, and wrote more docs. 2006-05-26 17:47:40 +00:00
Steve Holden
f845877767 Use minimum calibration time rather than avergae to avoid
the illusion of negative run times. Halt with an error if
run times go below 10 ms, indicating that results will be
unreliable.
2006-05-26 17:41:32 +00:00
Fredrik Lundh
3a65d87e8c needforspeed: remove remaining USE_FAST macros; if fastsearch was
broken, someone would have noticed by now ;-)
2006-05-26 17:31:41 +00:00
Fredrik Lundh
c2032fb86a needforspeed: cleanup 2006-05-26 17:26:39 +00:00
Fredrik Lundh
b947948c61 needforspeed: stringlib refactoring (in progress) 2006-05-26 17:22:38 +00:00
Thomas Heller
69bfaab304 Write some docs. 2006-05-26 17:18:33 +00:00
Fredrik Lundh
a50d201bd9 needforspeed: stringlib refactoring (in progress) 2006-05-26 17:04:58 +00:00
Tim Peters
877ab9bc23 Add missing svn:eol-style property to text files. 2006-05-26 16:53:04 +00:00
Tim Peters
584c8d4588 Whitespace normalization. 2006-05-26 16:52:04 +00:00
Tim Peters
735ae484f0 Repair Windows compiler warnings about mixing
signed and unsigned integral types in comparisons.
2006-05-26 16:49:28 +00:00
Thomas Heller
ada638bf91 For now, I gave up with automatic conversion of reST to Python-latex,
so I'm writing this in latex now.

Skeleton for the ctypes reference.
2006-05-26 16:42:44 +00:00
Fredrik Lundh
7c940d1d68 needforspeed: use Py_LOCAL on a few more locals in stringobject.c 2006-05-26 16:32:42 +00:00
Steve Holden
431a76314d Add -t option to allow easy test selection.
Action verbose option correctly.
Tweak operation counts. Add empty and new instances tests.
Enable comparisons across different warp factors. Change version.
2006-05-26 16:27:59 +00:00
Bob Ippolito
0cbf2c5785 fix signed/unsigned mismatch in struct 2006-05-26 16:23:28 +00:00
Andrew Dalke
725fe4089d Test for more edge strip cases; leading and trailing separator gets removed
even with strip(..., 0)
2006-05-26 16:22:52 +00:00
Andrew Dalke
02758d66ce Eeked out another 3% or so performance in split whitespace by cleaning up the algorithm. 2006-05-26 15:21:01 +00:00
Bob Ippolito
1d2b0e3f61 Enable PY_USE_INT_WHEN_POSSIBLE in struct 2006-05-26 14:29:35 +00:00
Bob Ippolito
685dda8b95 Fix _struct typo that broke some 64-bit platforms 2006-05-26 14:23:21 +00:00
Bob Ippolito
ad647859f4 Fix distutils so that libffi will cross-compile between darwin/x86 and darwin/ppc 2006-05-26 14:07:23 +00:00
Andrew M. Kuchling
c6f5c871b9 Typo fix 2006-05-26 14:04:19 +00:00
Andrew M. Kuchling
230c3e1bc0 Add buffer support for struct, socket 2006-05-26 14:03:41 +00:00
Tim Peters
02494764cb Explicitly close files. I'm trying to stop the frequent spurious test_tarfile
failures on Windows buildbots, but it's hard to know how since the regrtest
failure output is useless here, and it never fails when a buildbot slave runs
test_tarfile the second time in verbose mode.
2006-05-26 14:02:05 +00:00
Andrew Dalke
525eab3712 Changes to string.split/rsplit on whitespace to preallocate space in the
results list.

Originally it allocated 0 items and used the list growth during append.  Now
it preallocates 12 items so the first few appends don't need list reallocs.

("Here are some words ."*2).split(None, 1) is 7% faster
("Here are some words ."*2).split() is is 15% faster

  (Your milage may vary, see dealership for details.)

File parsing like this

    for line in f:
        count += len(line.split())

is also about 15% faster.  There is a slowdown of about 3% for large
strings because of the additional overhead of checking if the append is
to a preallocated region of the list or not.  This will be the rare case.
It could be improved with special case code but we decided it was not
useful enough.

There is a cost of 12*sizeof(PyObject *) bytes per list.  For the normal
case of file parsing this is not a problem because of the lists have
a short lifetime.  We have not come up with cases where this is a problem
in real life.

I chose 12 because human text averages about 11 words per line in books,
one of my data sets averages 6.2 words with a final peak at 11 words per
line, and I work with a tab delimited data set with 8 tabs per line (or
9 words per line).  12 encompasses all of these.

Also changed the last rstrip code to append then reverse, rather than
doing insert(0).  The strip() and rstrip() times are now comparable.
2006-05-26 14:00:45 +00:00
Tim Peters
b1f3251ceb Use open() to open files (was using file()). 2006-05-26 13:39:17 +00:00
Bob Ippolito
e27337b5d0 fix #1229380 No struct.pack exception for some out of range integers 2006-05-26 13:15:44 +00:00
Andrew Dalke
669fa188b1 Added more rstrip tests, including for prealloc'ed arrays 2006-05-26 13:05:55 +00:00
Bob Ippolito
910a08f6da quick hack to fix busted binhex test 2006-05-26 12:52:53 +00:00
Andrew M. Kuchling
ad0cb65fca Add str.partition() 2006-05-26 12:39:48 +00:00
Tim Peters
7e8053f921 Whitespace normalization. 2006-05-26 12:31:20 +00:00