1. 12 Jun, 2001 5 commits
    • Fred Drake's avatar
      Some small optimizations: · 8bd69dca
      Fred Drake authored
      SafeMapping.has_get():
          Simplify in order to reduce the number of Python bytecodes.  There
          is no longer a branch, which isn't strictly necessary.
      
      Context.evaluateStructure(), .evaluateMacro():
          Since these methods are essentially synonyms for evaluate(), avoid
          the extra method lookup & call by simply making them aliases.
      
      Context.evaluate():
          Re-arrange the try/except/except to avoid some of the exception
          catching by moving part of the try clause into an else clause.
      8bd69dca
    • Chris McDonough's avatar
      When operating on raw strings which had DOS-style linefeeds (e.g. "\r\n"),... · 88f00992
      Chris McDonough authored
      When operating on raw strings which had DOS-style linefeeds (e.g. "\r\n"), StructuredText would neglect to strip the trailing garbage off the end of a paragraph.  Thus, the test for "examples" and other features that depended on the last characters in a paragraph to not be whitespace for proper operation were failing, causing problems mainly for people who use Windows to author STX content.  This is now fixed.
      88f00992
    • Evan Simpson's avatar
      Use Ken's wording for the upload paragraph, and look for the body in... · 66ea9597
      Evan Simpson authored
      Use Ken's wording for the upload paragraph, and look for the body in REQUEST.other before REQUEST.form, so that errors will show up.
      66ea9597
    • Fred Drake's avatar
      · 2feef0d3
      Fred Drake authored
      Small optimizations to get this a little more out of the way when profiling.
      2feef0d3
    • Fred Drake's avatar
      · 38793800
      Fred Drake authored
      Delay expectation of being able to access the DummyEngine class, allowing
      circular import by the DummyEngine module.
      38793800
  2. 11 Jun, 2001 5 commits
  3. 09 Jun, 2001 1 commit
    • Fred Drake's avatar
      More micro-optimizations. · d05ff27d
      Fred Drake authored
      A (minor) change to the bytecode format: for "extended" attributes
      (handled by TALInterpreter.attrAction()), the instruction contains the
      integer previously retrieved from the actionIndex table; the bytecode
      generator now takes care of the lookup.  This allows attrAction() to
      no longer need to lookup the table that it used to lookup the
      integers.
      
      Many handlers are now separated into TAL and non-TAL versions -- the
      TALInterpreter constructor determines which dispatch table to use when
      it initializes self.tal (which is not changed later).  This allows
      each of the handlers to do only what is needed without having to
      decide based on the self.tal attribute.
      
      TALInterpreter.do_startTag() no longer contains a special case for an
      empty attribute list; that case is already optimized away by the
      bytecode generator.  What remains would actually work in that case,
      but it simply doesn't occur.  This removes one test of the attrList
      parameter.
      d05ff27d
  4. 08 Jun, 2001 19 commits
  5. 07 Jun, 2001 10 commits
    • Andreas Jung's avatar
      *** empty log message *** · 415a8342
      Andreas Jung authored
      415a8342
    • Shane Hathaway's avatar
      Because ZopeSecurityPolicy.checkPermission() used User.has_role(), it did · 958b76a4
      Shane Hathaway authored
      not behave as expected.  Permissions granted to Anonymous didn't
      necessarily get granted to other roles, for one thing.  This is an
      issue especially for the CMF.  User.allowed()
      is practically the same thing with the parameters reversed, so I changed
      checkPermission() to call User.allowed() instead.  We should be able to
      deprecate User.has_role() now.  I also implemented a minor (micro?)
      optimization by calling the aq_base module function instead of using getattr().
      958b76a4
    • Andreas Jung's avatar
      Collector #2287: added import of render_blocks (removed · 6053665c
      Andreas Jung authored
      while replacing an import * by a more selective import)
      6053665c
    • Shane Hathaway's avatar
      The _need__name__ protocol assigns a name to DTMLMethods implicitly · 6150e9df
      Shane Hathaway authored
      so that ExtensionClass can find the correct <name>__roles__ attribute
      of the method's class.  However it was discovered that this protocol
      has a flaw: if a DTMLMethod is bound to multiple names, there is no
      way for default__class_init__ to tell which name is the right one.
      
      This change adds code that detects the condition and makes the name
      explicit in all places where it occurs in the Zope core.  There are
      likely products out there that have the same condition so they will
      need a small correction.  For now this is a warning but it might be
      appropriate to later make the condition an error.
      6150e9df
    • Fred Drake's avatar
      · ff0e3677
      Fred Drake authored
      Update all the expected bytecode to conform to the new format.
      ff0e3677
    • Fred Drake's avatar
      Bump the version number of the generated byte-code; it looks a bit · b9635b0a
      Fred Drake authored
      different now!
      
      Use saved type objects when calling isinstance() instead of calling
      type() each time.
      
      getProgramMode(), getProgramVersion():
          Update to the new byte-code format.
      
      quote():
          Change the way cgi.escape() is referenced to avoid runtime
          lookups.
      b9635b0a
    • Fred Drake's avatar
      TALGenerator.optimize(): · 45a73765
      Fred Drake authored
          Re-write generated instructions:  (op, arg1, arg2, ...) becomes
          (op, (arg1, arg2, ...)) to reflect the change in the dispatch
          mechanism in TALInterpreter -- this avoids a tuple concatenation
          at dispatch time.
      45a73765
    • 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