Commit Graph

479 Commits

Author SHA1 Message Date
Barry Warsaw e2eca0b709 Port from the Python 2.4 branch, patches for SF bug # 900092,
hotshot.stats.load.
2005-08-15 18:14:19 +00:00
Phillip J. Eby 0d6615fd29 PEP 342 implementation. Per Guido's comments, the generator throw()
method still needs to support string exceptions, and allow None for the
third argument.  Documentation updates are needed, too.
2005-08-02 00:46:46 +00:00
Brett Cannon c9371d4a1b Fix signedness of various char variables to stop causing a warning under gcc 4. 2005-06-25 08:23:41 +00:00
Brett Cannon 55fa66dd45 Add comments about PyThreadState and the usage of its fields. 2005-06-25 07:07:35 +00:00
Hye-Shik Chang b6fa2814f7 Make a handy macro, Py_DEFAULT_RECURSION_LIMIT to allow to define
a default value of recursion limit from build systems.  1000 levels
are still too high for some 64bit systems.
2005-04-04 15:49:02 +00:00
Michael W. Hudson 75eabd2944 Change the name of the macro used by --with-tsc builds to the less
inscrutable READ_TIMESTAMP.
2005-01-18 15:56:11 +00:00
Skip Montanaro c9a4762bd6 comment tweak 2005-01-08 21:58:58 +00:00
Kurt B. Kaiser 4c79a83e0c Hye-Shik Chang's fix for Bug 875692.
Improve signal handling, especially when using threads, by forcing an early
re-execution of PyEval_EvalFrame() "periodic" code when things_to_do is not
cleared by Py_MakePendingCalls().

M Misc/NEWS
M Python/ceval.c
2004-11-23 18:06:08 +00:00
Tim Peters 7f468f29f4 SF patch 1044089: New C API function PyEval_ThreadsInitialized(), by Nick
Coghlan, for determining whether PyEval_InitThreads() has been called.
Also purged the undocumented+unused _PyThread_Started int.
2004-10-11 02:40:51 +00:00
Raymond Hettinger cfc3192677 SF bug #1014215: Unspecific errors with metaclass
High level error message was stomping useful detailed messages from lower
level routines.

The new approach is to augment string error messages returned by the low
level routines.  The provides both high and low level information.  If
the exception value is not a string, no changes are made.

To see the improved messages in action, type:
   import random
   class R(random): pass
   class B(bool): pass
2004-09-16 16:41:57 +00:00
Martin v. Löwis 87fa785f0f Centralize WITH_TSC processing. 2004-08-29 15:51:52 +00:00
Michael W. Hudson 800ba2375a This is my patch:
[ 1005891 ] support --with-tsc on PPC

plus a trivial change to settscdump's docstring and a Misc/NEWS entry.
2004-08-12 18:19:17 +00:00
Armin Rigo 618fbf5469 This was quite a dark bug in my recent in-place string concatenation
hack: it would resize *interned* strings in-place!  This occurred because
their reference counts do not have their expected value -- stringobject.c
hacks them.  Mea culpa.
2004-08-07 20:58:32 +00:00
Raymond Hettinger 52a21b8e65 SF patch #980695: efficient string concatenation
(Original patch by Armin Rigo).
2004-08-06 18:43:09 +00:00
Michael W. Hudson a3711f73c1 Fix for the unfortunate fact that PyDict_GetItem and PyObject_GetItem
have differing refcount semantics.  If anyone sees a prettier way to
acheive the same ends, then please go for it.

I think this is the first time I've ever used Py_XINCREF.
2004-08-02 14:50:43 +00:00
Raymond Hettinger 66bd233225 Completed the patch for Bug #215126.
* Fixes an incorrect variable in a PyDict_CheckExact.
* Allow general mapping locals arguments for the execfile() function
  and exec statement.
* Add tests.
2004-08-02 08:30:07 +00:00
Neal Norwitz 93468eac72 Remove unused macros in .c files 2004-07-08 01:49:00 +00:00
Michael W. Hudson 30ea2f223f This closes patch:
[ 960406 ] unblock signals in threads

although the changes do not correspond exactly to any patch attached to
that report.

Non-main threads no longer have all signals masked.

A different interface to readline is used.

The handling of signals inside calls to PyOS_Readline is now rather
different.

These changes are all a bit scary!  Review and cross-platform testing
much appreciated.
2004-07-07 17:44:12 +00:00
Raymond Hettinger 214b1c3aae SF Bug #215126: Over restricted type checking on eval() function
The builtin eval() function now accepts any mapping for the locals argument.
Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing
down the normal case.  My timings so no measurable impact.
2004-07-02 06:41:07 +00:00
Martin v. Löwis 8d97e33bb7 Patch #966493: Cleanup generator/eval_frame exposure. 2004-06-27 15:43:12 +00:00
Raymond Hettinger a7f56bc0cc Get ceval.c to compile again by moving declarations before other statments. 2004-06-26 04:34:33 +00:00
Nicholas Bastin d858a7763a Massive performance improvement for C extension and builtin tracing code 2004-06-25 23:31:06 +00:00
Nicholas Bastin 941b8bc41a Less ugly #ifdefs for C profiling fix 2004-06-22 15:37:51 +00:00
Nicholas Bastin bbffbd1983 One forgotten C profiling #ifdef 2004-06-22 04:18:47 +00:00
Nicholas Bastin 4c70b69fb1 Making C profiling a configure option (at least temporarily) 2004-06-22 03:51:38 +00:00
Raymond Hettinger 9c18e81fb2 Install two code generation optimizations that depend on NOP.
Reduces the cost of "not" to almost zero.
2004-06-21 16:31:15 +00:00
Armin Rigo 8817fcdba5 Performance tweak: allow stack_pointer and oparg to be register variables.
SF patch #943898
2004-06-17 10:22:40 +00:00
Martin v. Löwis f30d60edbc Patch #510695: Add TSC profiling for the VM. 2004-06-08 08:17:44 +00:00
Raymond Hettinger f2c0830585 SF bug #963956: Bad error mesage when subclassing a module
Add a more informative message for the common user mistake of subclassing
from a module name rather than another class (i.e. random instead of
random.random).
2004-06-05 06:16:22 +00:00
Martin v. Löwis e440e47e91 Patch #957398: Add public API for Generator Object/Type. 2004-06-01 15:22:42 +00:00
Raymond Hettinger c8aa08b172 Some (but not all) of the why code bitfield tests ran faster as
separate equality tests.  Now, all are set to their best timing.
2004-04-11 14:59:33 +00:00
Raymond Hettinger 5bed456056 Revert 2.393, elimination of pre-decrementing, which
did not stand-up to additional timings.
2004-04-10 23:34:17 +00:00
Raymond Hettinger 7eddd78a15 Use continue instead of break whereever possible. 2004-04-07 14:38:08 +00:00
Raymond Hettinger d3b836d202 * Improve readability and remove data dependencies by converting
pre-increment forms to post-increment forms.  Post-incrementing
also eliminates the need for negative array indices for oparg fetches.

* In exception handling code, check for class based exceptions before
  the older string based exceptions.
2004-04-07 13:17:27 +00:00
Raymond Hettinger 467a698bd2 Small code improvements for readability, code size, and/or speed.
BINARY_SUBSCR:
    * invert test for normal case fall through
    * eliminate err handling code by jumping to slow_case

LOAD_LOCALS:
    * invert test for normal case fall through
    * continue instead of break for the non-error case

STORE_NAME and DELETE_NAME:
    * invert test for normal case fall through

LOAD_NAME:
    * continue instead of break for the non-error case

DELETE_FAST:
    * invert test for normal case fall through

LOAD_DEREF:
    * invert test for normal case fall through
    * continue instead of break for the non-error case
2004-04-07 11:39:21 +00:00
Raymond Hettinger 7c9586545e Simplify previous checkin (bitfields for WHY codes).
Restores the self-documenting enum declaration.
2004-04-06 10:11:10 +00:00
Raymond Hettinger 06032cb664 Coded WHY flags as bitfields (taking inspiration from tp_flags).
This allows multiple flags to be tested in a single compare
which eliminates unnecessary compares and saves a few bytes.
2004-04-06 09:37:35 +00:00
Tim Peters 8a5c3c76be Since the fast_yield branch target was introduced, it appears that most
tests of "why" against WHY_YIELD became useless.  This patch removes them,
but assert()s that why != WHY_YIELD everywhere such a test was removed.
The test suite ran fine under a debug build (i.e., the asserts never
triggered).
2004-04-05 19:36:21 +00:00
Nicholas Bastin e5662aedef Changed random calls to PyThreadState_Get() to use the macro 2004-03-24 22:22:12 +00:00
Nicholas Bastin c69ebe8d50 Enable the profiling of C functions (builtins and extensions) 2004-03-24 21:57:10 +00:00
Armin Rigo bf57a14522 Fix SF bug #765624. 2004-03-22 19:24:58 +00:00
Armin Rigo 9dbf9084e8 Cancelled checkin, sorry. 2004-03-20 21:50:13 +00:00
Armin Rigo 1515fc2a01 A 2% speed improvement with gcc on low-endian machines. My guess is that this
new pattern for NEXTARG() is detected and optimized as a single (*short)
loading.
2004-03-20 20:03:17 +00:00
Raymond Hettinger fba1cfc49a LIST_APPEND is predicably followed by JUMP_ABSOLUTE.
Reduces loop overhead by an additional 10%.
2004-03-12 16:33:17 +00:00
Raymond Hettinger 2d783e9b16 Move the code for BREAK and CONTINUE_LOOP to be near FOR_ITER.
Makes it more likely that all loop operations are in the cache
at the same time.
2004-03-12 09:12:22 +00:00
Raymond Hettinger db0de9e7ca Speedup for-loops by inlining PyIter_Next(). Saves duplicate tests
and a function call resulting in a 15% reduction of total loop overhead
(as measured by timeit.Timer('pass')).
2004-03-12 08:41:36 +00:00
Raymond Hettinger f114a3ae63 Refactor and optimize code for UNPACK_SEQUENCE.
* Defer error handling for wrong number of arguments to the
  unpack_iterable() function.  Cuts the code size almost in half.

* Replace function calls to PyList_Size() and PyTuple_Size() with
  their smaller and faster macro counterparts.

* Move the constant structure references outside of the inner loops.
2004-03-08 23:25:30 +00:00
Raymond Hettinger dd80f76265 SF patch #910929: Optimize list comprehensions
Add a new opcode, LIST_APPEND, and apply it to the code generation for
list comprehensions.  Reduces the per-loop overhead by about a third.
2004-03-07 07:31:06 +00:00
Skip Montanaro 786ea6bc23 Add pystack definition to Misc/gdbinit with some explanation of its behavior
and add flag comments to ceval.c and main.c alerting people to the coupling
between pystack and the layout of those files.
2004-03-01 15:44:05 +00:00
Michael W. Hudson ecfeb7f095 This is my patch #876198 plus a NEWS entry and a header frob.
Remove the ability to use (from C) arbitrary objects supporting the
read buffer interface as the co_code member of code objects.
2004-02-12 15:28:27 +00:00
Skip Montanaro 7befb9966e remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
Raymond Hettinger a72169871d SF patch #884022: dynamic execution profiling vs opcode prediction
(Contributed by Andrew I MacIntyre.)

disables opcode prediction when dynamic execution
profiling is in effect, so the profiling counters at
the top of the main interpreter loop in eval_frame()
are updated for each opcode.
2004-02-08 19:59:27 +00:00
Raymond Hettinger 1dd8309246 SF patch #864059: optimize eval_frame
Simplified version of Neal Norwitz's patch which adds gotos for
opcodes that set "why".  This skips a number of tests where the
outcome of the tests are known in advance.
2004-02-06 18:32:33 +00:00
Jack Jansen eddc1449ba Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
Jeremy Hylton 904ed86a77 Make undetected error on stack unwind a fatal error. 2003-11-05 17:29:35 +00:00
Armin Rigo 2b3eb4062c Deleting cyclic object comparison.
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Armin Rigo 1d313ab9d1 oh dear. Wrong manipulation. Committed a version of ceval.c from my
no-cyclic-comparison patch at the same time as errors.c.

Reverting ceval.c to the previous revision.
2003-10-25 14:33:09 +00:00
Armin Rigo 092381a979 Made function declaration a proper C prototype 2003-10-25 14:29:27 +00:00
Raymond Hettinger 8ae4689657 Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c)  -->  PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a)         -->  PyTuple_New(0)
* Py_BuildValue("O", a)         -->  Py_INCREF(a)
2003-10-12 19:09:37 +00:00
Neal Norwitz c5131bc256 Fix SF #762455, segfault when sys.stdout is changed in getattr
Will backport.
2003-06-29 14:48:32 +00:00
Guido van Rossum b8b6d0c2c6 Add PyThreadState_SetAsyncExc(long, PyObject *).
A new API (only accessible from C) to interrupt a thread by sending it
an exception.  This is not always effective, but might help some people.
Requested by Just van Rossum and Alex Martelli.  It is intentional
that you have to write your own C extension to call it from Python.

Docs will have to wait.
2003-06-28 21:53:52 +00:00
Neil Schemenauer c4b570f218 Use fast_next_opcode shortcut for forward jump opcodes (it's safe and
gives a small speedup).
2003-06-01 19:21:12 +00:00
Raymond Hettinger 40174c358f SF bug #733667: kwargs handled incorrectly
The fast_function() inlining optimization only
applies when there are zero keyword arguments.
2003-05-31 07:04:16 +00:00
Neil Schemenauer ca2a2f11d0 Don't use fast_next_opcode for JUMP_* opcodes. This fixes the problem
reported by Kurt B. Kaiser.
2003-05-30 23:59:44 +00:00
Michael W. Hudson 58ee2af48e Armin Rigo's fix & test for
[ 729622 ] line tracing hook errors

with massaging from me to integrate test into test suite.
2003-04-29 16:18:47 +00:00
Raymond Hettinger f4cf76dd5e Revert the previous enhancement to the bytecode optimizer.
The additional code complexity and new NOP opcode were not worth it.
2003-04-24 05:45:23 +00:00
Raymond Hettinger 060641d511 Improved the bytecode optimizer.
* Can now test for basic blocks.
* Optimize inverted comparisions.
* Optimize unary_not followed by a conditional jump.
* Added a new opcode, NOP, to keep code size constant.
* Applied NOP to previous transformations where appropriate.

Note, the NOP would not be necessary if other functions were
added to re-target jump addresses and update the co_lnotab mapping.
That would yield slightly faster and cleaner bytecode at the
expense of optimizer simplicity and of keeping it decoupled
from the line-numbering structure.
2003-04-22 06:49:11 +00:00
Mark Hammond 8d98d2cb95 New PyGILState_ API - implements pep 311, from patch 684256. 2003-04-19 15:41:53 +00:00
Guido van Rossum a12fe4e81f - New function sys.call_tracing() allows pdb to debug code
recursively.
- pdb has a new command, "debug", which lets you step through
  arbitrary code from the debugger's (pdb) prompt.
2003-04-09 19:06:21 +00:00
Raymond Hettinger 7dc52212aa Eliminate data dependency in predict macro.
Added two predictions:
  GET_ITER --> FOR_ITER
  FOR_ITER --> STORE_FAST or UNPACK_SEQUENCE

Improves timings on pybench and timeit.py. Pystone results are neutral.
2003-03-16 20:14:44 +00:00
Raymond Hettinger ac2072920d Fix comment and whitespace. 2003-03-16 15:41:11 +00:00
Raymond Hettinger f606f87b31 Introduced macros for a simple opcode prediction protocol.
Applied to common cases:
    COMPARE_OP is often followed by a JUMP_IF.
    JUMP_IF is usually followed by POP_TOP.

Shows improved timings on PyStone, PyBench, and specific tests
using timeit.py:
    python timeit.py -s "x=1" "if x==1: pass"
    python timeit.py -s "x=1" "if x==2: pass"
    python timeit.py -s "x=1" "if x: pass"
    python timeit.py -s "x=100" "while x!=1: x-=1"

Potential future candidates:
    GET_ITER predicts FOR_ITER
    FOR_ITER predicts STORE_FAST or UNPACK_SEQUENCE

Also, applied missing goto fast_next_opcode to DUP_TOPX.
2003-03-16 03:11:04 +00:00
Raymond Hettinger 080cb3268f SF patch #701907: More use of fast_next_opcode
My previous patches should have used fast_next_opcode
in a few places instead of continue.

Also, applied one PyInt_AS_LONG macro in a place where
the type had already been checked.
2003-03-14 01:37:42 +00:00
Guido van Rossum c9fbb72ba5 Added implementation notes for [re]set_exc_info(). 2003-03-01 03:36:33 +00:00
Michael W. Hudson e46d1559c9 In the process of adding all the extended slice support I attempted to
change _PyEval_SliceIndex to round massively negative longs up to
-INT_MAX, instead of 0 but botched it.  Get it right.

Thx to Armin for the report.
2003-02-27 14:50:34 +00:00
Raymond Hettinger 21012b8235 Micro-optimizations.
* List/Tuple checkexact is faster for the common case.
* Testing for Py_True and Py_False can be inlined for faster looping.
2003-02-26 18:11:50 +00:00
Guido van Rossum 6297a7a9fb - PyEval_GetFrame() is now declared to return a PyFrameObject *
instead of a plain PyObject *.  (SF patch #686601 by Ben Laurie.)
2003-02-19 15:53:17 +00:00
Just van Rossum 3aaf42c613 patch #683515: "Add unicode support to compile(), eval() and exec"
Incorporated nnorwitz's comment re. Py__USING_UNICODE.
2003-02-10 08:21:10 +00:00
Jeremy Hylton 985eba53f5 Small function call optimization and special build option for call stats.
-DCALL_PROFILE: Count the number of function calls executed.

When this symbol is defined, the ceval mainloop and helper functions
count the number of function calls made.  It keeps detailed statistics
about what kind of object was called and whether the call hit any of
the special fast paths in the code.

Optimization:

When we take the fast_function() path, which seems to be taken for
most function calls, and there is minimal frame setup to do, avoid
call PyEval_EvalCodeEx().  The eval code ex function does a lot of
work to handle keywords args and star args, free variables,
generators, etc.  The inlined version simply allocates the frame and
copies the arguments values into the frame.

The optimization gets a little help from compile.c which adds a
CO_NOFREE flag to code objects that don't have free variables or cell
variables.  This change allows fast_function() to get into the fast
path with fewer tests.

I measure a couple of percent speedup in pystone with this change, but
there's surely more that can be done.
2003-02-05 23:13:00 +00:00
Raymond Hettinger 4bad9ba282 SF patch #670367: Micro-optimizations for ceval.c
Make the code slightly shorter, faster, and easier to
read.

* Eliminate unused DUP_TOPX code for x==1.
compile.c always generates DUP_TOP instead.

* Since only two cases remain for DUP_TOPX, replace
the switch-case with if-elseif.

* The in-lined integer compare does a CheckExact on
both arguments. Since the second is a little more
likely to fail, test it first.

* The switch-case for IS/IS_NOT and IN/NOT_IN can
separate the regular and inverted cases with no
additional work. For all four paths, saves a test and
jump.
2003-01-19 05:08:13 +00:00
Raymond Hettinger 8bb90a59a6 Replaced POP() with STACKADJ(-1) on lines where the result wasn't used.
The two are semantically equivalent, but the first triggered a compiler
warning about an unused variable.  Note, the preceding steps had already
accessed and decreffed the variable so the reference counts were fine.
2003-01-14 12:43:10 +00:00
Raymond Hettinger 71731d7f70 As discussed on python-dev, removed from DUP_TOPX support for the
parameter being either four or five.  Currently, compile.c does not
generate calls with a parameter higher than three.

May have to be reverted if the second alpha or beta shakes out some
other tool generating this op code with a parameter of four or five.
2003-01-10 16:45:17 +00:00
Neal Norwitz 37aa066164 As discussed briefly on python-dev, add Pending Deprecation Warning
when a string exception is raised.  Note that raising string exceptions
is deprecated in an exception message.
2003-01-10 15:31:15 +00:00
Raymond Hettinger 663004bb3d SF patch #664320: Replace push/pop clusters in ceval.c
Replaced groups of pushes and pops with indexed access to the stack and
a single adjustment (if needed) to the stacklevel.

Avoids scores of unnecessary increments and decrements to the stackpointer.
Removes unnecessary sequential dependencies so that the compiler has more
freedom for optimizations.  Frees the processor for more parallel and
pipelined execution by using mostly read-only access and having few pointer
adjustments just prior to a read or write.
2003-01-09 15:24:30 +00:00
Neal Norwitz addfe0c09c Make private functions static so we don't pollute the namespace 2002-11-10 14:33:26 +00:00
Michael W. Hudson 006c75265f This is Richie Hindle's patch:
[ 631276 ] Exceptions raised by line trace function

It conflicted with the patches from Armin I just checked it, so I had
to so some bits by hand.
2002-11-08 13:08:46 +00:00
Michael W. Hudson 019a78e76d Assorted patches from Armin Rigo:
[ 617309 ] getframe hook (Psyco #1)
[ 617311 ] Tiny profiling info (Psyco #2)
[ 617312 ] debugger-controlled jumps (Psyco #3)

These are forward ports from 2.2.2.
2002-11-08 12:53:11 +00:00
Michael W. Hudson cbd6fb9006 Handle really big steps in extended slices.
Fixes a test failure on 64 bit platforms (I hope).
2002-11-06 15:17:32 +00:00
Michael W. Hudson ca803a0dd7 One last tweak to the tracing machinery: this actually computes what I intended
all along.  Before instr_lb tended to be too high.

I don't think this actually makes any difference, given what the compiler
produces, but it makes me a bit happier.
2002-10-03 09:53:11 +00:00
Michael W. Hudson fb4d6ecd07 Fix for the recursion_level bug Armin Rigo reported in sf
patch #617312, both on the trunk and the 22-maint branch.

Also added a test case, and ported the test_trace I wrote for HEAD
to 2.2.2 (with all those horrible extra 'line' events ;-).
2002-10-02 13:13:45 +00:00
Michael W. Hudson 02ff6a9952 A slight change to SET_LINENO-less tracing.
This makes things a touch more like 2.2.  Read the comments in
Python/ceval.c for more details.
2002-09-11 15:36:32 +00:00
Skip Montanaro 99dba27e9a Bump default check interval to 100 instructions. Computers are much faster
than when this interval was first established.  Checking too frequently just
adds needless overhead because most of the time there is nothing to do and
no other threads ready to run.
2002-09-03 20:19:06 +00:00
Skip Montanaro d581d7792b replace thread state objects' ticker and checkinterval fields with two
globals, _Py_Ticker and _Py_CheckInterval.  This also implements Jeremy's
shortcut in Py_AddPendingCall that zeroes out _Py_Ticker.  This allows the
test in the main loop to only test a single value.

The gory details are at

    http://python.org/sf/602191
2002-09-03 20:10:45 +00:00
Michael W. Hudson 53d58bb369 Further SET_LINENO reomval fixes. See comments in patch #587933.
Use a slightly different strategy to determine when not to call the line
trace function.  This removes the need for the RETURN_NONE opcode, so
that's gone again.  Update docs and comments to match.

Thanks to Neal and Armin!

Also add a test suite.  This should have come with the original patch...
2002-08-30 13:09:51 +00:00
Guido van Rossum 86c659a329 The error messages in err_args() -- which is only called when the
required number of args is 0 or 1 -- were reversed.  Also change "1"
into "exactly one", the same words as used elsewhere for this
condition.
2002-08-23 14:11:35 +00:00
Michael W. Hudson c230b0e1f9 Comment typo repair. 2002-08-20 15:43:16 +00:00
Michael W. Hudson 62897c5c13 My patch #597221. Use f_lasti more consistently. 2002-08-20 15:19:14 +00:00
Guido van Rossum d8dbf847b6 Add a warning comment to the LOAD_GLOBAL inline code. 2002-08-19 21:17:53 +00:00
Guido van Rossum 3a4dfc87e6 Another ugly inlining hack, expanding the two PyDict_GetItem() calls
in LOAD_GLOBAL.  Besides saving a C function call, it saves checks
whether f_globals and f_builtins are dicts, and extracting and testing
the string object's hash code is done only once.  We bail out of the
inlining if the name is not exactly a string, or when its hash is -1;
because of interning, neither should ever happen.  I believe interning
guarantees that the hash code is set, and I believe that the 'names'
tuple of a code object always contains interned strings, but I'm not
assuming that -- I'm simply testing hash != -1.

On my home machine, this makes a pystone variant with new-style
classes and slots run at the same speed as classic pystone!  (With
new-style classes but without slots, it is still a lot slower.)
2002-08-19 20:24:07 +00:00
Jeremy Hylton 192690e2d2 Inline fast_cfunction() in new call_function().
Also, don't handle METH_OLDARGS on the fast path.  All the interesting
builtins have been converted to use METH_NOARGS, METH_O, or
METH_VARARGS.

Result is another 1-2% speedup.  If I can cobble together 10 of these,
it might make a difference.
2002-08-16 18:36:11 +00:00