1. 12 Aug, 2002 7 commits
    • Tim Peters's avatar
      x_mul(): This failed to normalize its result. · 44121a6b
      Tim Peters authored
      k_mul():  This didn't allocate enough result space when one input had
      more than twice as many bits as the other.  This was partly hidden by
      that x_mul() didn't normalize its result.
      
      The Karatsuba recurrence is pretty much hosed if the inputs aren't
      roughly the same size.  If one has at least twice as many bits as the
      other, we get a degenerate case where the "high half" of the smaller
      input is 0.  Added a special case for that, for speed, but despite that
      it helped, this can still be much slower than the "grade school" method.
      It seems to take a really wild imbalance to trigger that; e.g., a
      2**22-bit input times a 1000-bit input on my box runs about twice as slow
      under k_mul than under x_mul.  This still needs to be addressed.
      
      I'm also not sure that allocating a->ob_size + b->ob_size digits is
      enough, given that this is computing k = (ah+al)*(bh+bl) instead of
      k = (ah-al)*(bl-bh); i.e., it's certainly enough for the final result,
      but it's vaguely possible that adding in the "artificially" large k may
      overflow that temporarily.  If so, an assert will trigger in the debug
      build, but we'll probably compute the right result anyway(!).
      44121a6b
    • Tim Peters's avatar
      Introduced helper functions v_iadd and v_isub, for in-place digit-vector · 877a2126
      Tim Peters authored
      addition and subtraction.  Reworked the tail end of k_mul() to use them.
      This saves oodles of one-shot longobject allocations (this is a triply-
      recursive routine, so saving one allocation in the body saves 3**n
      allocations at depth n; we actually save 2 allocations in the body).
      877a2126
    • Guido van Rossum's avatar
      New news about __class__ assignment restrictions and speed-up of · e343878e
      Guido van Rossum authored
      new-style object creation/deallocation.
      
      Moved all news about type/class unification and new-stype classes to a
      separate section at the top.
      e343878e
    • Neal Norwitz's avatar
      6c70fca8
    • Tim Peters's avatar
      fc07e568
    • Tim Peters's avatar
      k_mul(): Repaired typo in comment. · 18c15b9b
      Tim Peters authored
      18c15b9b
    • Tim Peters's avatar
      Cautious introduction of a patch that started from · 5af4e6c7
      Tim Peters authored
      SF 560379:  Karatsuba multiplication.
      Lots of things were changed from that.  This needs a lot more testing,
      for correctness and speed, the latter especially when bit lengths are
      unbalanced.  For now, the Karatsuba code gets invoked if and only if
      envar KARAT exists.
      5af4e6c7
  2. 11 Aug, 2002 8 commits
  3. 10 Aug, 2002 10 commits
  4. 09 Aug, 2002 15 commits