Tree vector benchmark... I finally put all the pieces I've been building together (especially the red/black tree index) into a TreeVector class. This class has the same interface as two other vector classes I built: one based on native Java arrays, the other on standard Java TreeMap. Preliminary performance testing gives me the expected results: my TreeVector class outperforms the array-based class both in memory consumption and CPU consumption when the vector is relatively sparse and large. For instance, with a vector of 2000 entries with 2% of them non-zero, the TreeVector instances use about 5% as much memory and are more than 10x faster (this varies by operation, with add multiple of another vector being particularly fast). These advantages decline as the percentage of non-zero entries increases, of course. When the non-zero entries approach 50%, the memory consumption advantage disappears. The performance advantage is mostly gone when non-zero entries approach 80%.
The same building blocks I used for TreeVector (the red/black tree index and a key/value storage scheme for doubles) will also be used for two sparse matrix implementations. One of them will have a tree vector for each row; the other for each row and each column. These matrices will be convertible, one to the other, and each will have advantages in different stages of the Gaussian elimination process. The memory and CPU consumption advantages of these building blocks should be even more dramatic when I'm using them in the matrices...
No comments:
Post a Comment