Commit Graph

34650 Commits

Author SHA1 Message Date
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
Andrew Dalke 5cc6009f0d Test cases for off-by-one errors in string split with multicharacter pattern. 2006-05-26 12:31:00 +00:00
Andrew Dalke 005aee2c39 I like tests.
The new split functions use a preallocated list.  Added tests which exceed
the preallocation size, to exercise list appends/resizes.

Also added more edge case tests.
2006-05-26 12:28:15 +00:00
Tim Peters fe98f9613b Whitespace normalization. 2006-05-26 12:26:21 +00:00
Ronald Oussoren 736123605c - Remove previous version of the binary distribution script for OSX
- Some small bugfixes for the IDLE.app wrapper
- Tweaks to build-installer to ensure that python gets build in the right way,
  including sqlite3.
- Updated readme files
2006-05-26 12:23:20 +00:00
Martin Blais 2856e5f390 Support for buffer protocol for socket and struct.
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
  protocol (send and sendto already did).

* Added struct.pack_to(), that is the corresponding buffer compatible method to
  unpack_from().

* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Fredrik Lundh 1b94940165 Py_LOCAL shouldn't be used for data; it works for some .NET 2003 compilers,
but Trent's copy thinks that it's an anachronism...
2006-05-26 12:01:49 +00:00
Andrew M. Kuchling a0fcf502df Typo fixes 2006-05-26 12:01:44 +00:00
Fredrik Lundh 57640f5c57 needforspeed: added PY_LOCAL_AGGRESSIVE macro to enable "aggressive"
LOCAL inlining; also added some missing whitespace
2006-05-26 11:54:04 +00:00
Ronald Oussoren 567a8ffd09 Integrate installing a framework in the 'make install'
target. Until now users had to use 'make frameworkinstall'
to install python when it is configured with '--enable-framework'.
This tends to confuse users that don't hunt for readme files
hidden in platform specific directories :-)
2006-05-26 11:43:26 +00:00
Ronald Oussoren 39be38c965 - Search the sqlite specific search directories
after the normal include directories when looking
  for the version of sqlite to use.
- On OSX:
  * Extract additional include and link directories
    from the CFLAGS and LDFLAGS, if the user has
    bothered to specify them we might as wel use them.
  * Add '-Wl,-search_paths_first' to the extra_link_args
    for readline and sqlite. This makes it possible to
    use a static library to override the system provided
    dynamic library.
2006-05-26 11:38:39 +00:00
Fredrik Lundh 95e2a91615 use Py_LOCAL also for string and unicode objects 2006-05-26 11:38:15 +00:00
Jack Diederich df676c5ffd when generating python code prefer to generate valid python code 2006-05-26 11:37:20 +00:00
Fredrik Lundh b8b3c8e276 needforspeed: added Py_LOCAL macro, based on the LOCAL macro used
for SRE and others.  applied Py_LOCAL to relevant portion of ceval,
which gives a 1-2% speedup on my machine.  ymmv.
2006-05-26 11:29:39 +00:00
Georg Brandl a172c32c05 Add "partition" to UserString. 2006-05-26 11:26:11 +00:00
Ronald Oussoren 072a24c33a Fix buglet in postinstall script, it would generate an invalid .cshrc file. 2006-05-26 11:17:55 +00:00
Andrew Dalke 03fb444990 Added split whitespace checks for characters other than space. 2006-05-26 11:15:22 +00:00
Jack Diederich 6c433a91d5 use Py_ssize_t in places that may need it 2006-05-26 11:15:17 +00:00