1. 07 Jun, 2001 3 commits
    • Fred Drake's avatar
      Lots of micro-performance adjustments using conventional Python · 9e161e97
      Fred Drake authored
      techniques of reducing the number of lookups and avoiding method
      calls.
      
      More interestingly, the dispatch machinery has changed, especially
      TALInterpreter.iterpret().  Each instruction is now composed of a
      2-tuple of the form (opcode, (arg1, arg2, ...)).  This is important as
      it allows more efficient unpacking and construction of the argument
      list for the call to the handlers for individual bytecodes.
      
      The bytecode handlers are also located differently.  Instead of using
      the opcode string to construct a method name, retrieve a bound method,
      and then calling it via apply(), a dictionary of handler functions is
      created as part of the class definition.  Handlers are retrieved from
      this dictionary by opcode string (avoiding string concatenation and
      bound method creation in the inner dispatch loop).  The handlers (now
      functions rather than methods) are then called using apply(), creating
      the arguments to the handler by tuple concatenation, which is faster
      than creating the bound method and then using the slower
      method-calling machinery.  Temporary variables are avoided whenever
      possible.
      
      The test for "debug mode" in TALInterpreter.interpret() was moved out
      of the dispatch loop; it is used to select one of the two versions of
      the loop.
      
      Support has been added for two new bytecodes:
        rawtextColumn -- used when the TALGenerator can determine the
                         resulting column number ahead of time (the text
                         includes a newline)
      
        rawtextOffset -- used when the TALGenerator cannot determine the
                         final column of the text (there is no newline).
      
      These new bytecodes allow the interpreter to avoid having to search
      for a newline for all rawtext instructions -- the compiler is able to
      determine which of these two cases is appropriate for each rawtext
      chunk -- the old 'rawtext' instruction is no longer generated.
      
      Re-phrased some conditions in if statements to allow more
      short-circuiting.
      9e161e97
    • Fred Drake's avatar
      PathExpr._eval(): · 7e9bc113
      Fred Drake authored
          Very aggressively cache anything that involves a global lookup.
      
      restrictedTraverse():
          Only cache things once it's possible we might use them.  Use the
          cached getattr() in one plase where the global was being looked up
          again.  Cache hasattr() as well.  Only construct the marker (M)
          once, not once for each call.
      7e9bc113
    • Fred Drake's avatar
      SafeMapping: · a93f1dd9
      Fred Drake authored
          The _push() and _pop() methods aren't really any different from
          the push() and pop() methods from the base MultiMap, so we can use
          them directly to avoid a lot of looks and method invocation
          overhead, and it's easier to tell from the code that they are just
          a renaming.
      
      Context.beginScope(), .endScope():
          Move an attribute access out of the loop since the attribute isn't
          re-bound inside the loop.
      
      Context.evaluateText():
          Re-phrase the condition in the if statement to allow the runtime
          to perform fewer global name lookups when possible, and avoid the
          tuple construction completely.
      a93f1dd9
  2. 06 Jun, 2001 4 commits
  3. 05 Jun, 2001 9 commits
    • Andreas Jung's avatar
      *** empty log message *** · e5c06e8d
      Andreas Jung authored
      e5c06e8d
    • Fred Drake's avatar
      · 5a94e38f
      Fred Drake authored
      Do not test for sys.exc_info(); it was already present in Python 2.1.
      This simplifies code and improves performance (very slightly).
      
      In two places, object type was tested by calling type() on each of two
      values and comparing the results (4 dict lookups, 2 Python->C function
      calls).  Replace each with an isinstance() call comparing to a saved
      type object (3 dict lookups, 1 Python->C function call, more future-proof).
      5a94e38f
    • Andreas Jung's avatar
      · a374dd25
      Andreas Jung authored
      Moved ISO8601 into DateTime class.
      DateTime constructor now also accepts ISO8601 dates.
      a374dd25
    • Chris McDonough's avatar
      *** empty log message *** · 5239f898
      Chris McDonough authored
      5239f898
    • Andreas Jung's avatar
      added parser/constructor for ISO 8601 dates · 59db7e71
      Andreas Jung authored
      59db7e71
    • Andreas Jung's avatar
      code cleanup · 6b166e2e
      Andreas Jung authored
      6b166e2e
    • Andreas Jung's avatar
      removed annoying warning · 4c886874
      Andreas Jung authored
      4c886874
    • Andreas Jung's avatar
      · c6172d12
      Andreas Jung authored
      Fixed (hopefully) a longtime outstanding problem in parens():
      - the former regex never matched any parentheses
      - the parens() used old regex module API although 're' module was used
      c6172d12
    • Andreas Jung's avatar
      Fixed (hopefully) a longtime outstanding problem in parens(): · fe555b16
      Andreas Jung authored
      - the former regex never matched any parentheses
      - the parens() used old regex module API although 're' module was used
      fe555b16
  4. 04 Jun, 2001 12 commits
  5. 03 Jun, 2001 1 commit
  6. 02 Jun, 2001 1 commit
    • Fred Drake's avatar
      · 812809bd
      Fred Drake authored
      Fix imports so that XML import works with Python 2.1.  The addition of
      __all__ to the pickle module, and the import constraints that causes symbols
      not listed in __all__ not to be imported by "import *", caused these modules
      to break because some names were not acquired from the pickle module which
      had been acquired before.
      
      This patch adds the appropriate imports so that dependence on the pickle
      module's implementation details is avoided.
      812809bd
  7. 01 Jun, 2001 10 commits