~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/intset.py

  • Committer: Martin Pool
  • Date: 2005-07-17 18:26:45 UTC
  • Revision ID: mbp@sourcefrog.net-20050717182642-9116d11beacc6bc5
- oops, set() is much faster than intset

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# Author: Martin Pool <mbp@canonical.com>
20
20
 
21
21
 
 
22
# Somewhat surprisingly, it turns out that this is much slower than
 
23
# simply storing the ints in a set() type.  Python's performance model
 
24
# is very different to that of C.
 
25
 
 
26
 
22
27
class IntSet(Exception):
23
28
    """Faster set-like class storing only whole numbers.
24
29
 
59
64
    [10]
60
65
    
61
66
    """
62
 
    # __slots__ = ['_val']
 
67
    __slots__ = ['_val']
63
68
 
64
69
    def __init__(self, values=None, bitmask=0L):
65
70
        """Create a new intset.