Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

High performance library for set operations?

  1. May 14, 2008 #1
    I need to perform standard set theory operations such as union, intersection, difference on sets of integer numbers. Each set can have a few hundred elements and each operation can involve a few hundred sets.

    The operations can easily be written in Java using the Java Collections Framework, but I am very concerned about the performance. There are several other similar frameworks in all kinds of programming languages, but which one is really suitable for processing massive amounts of data?
  2. jcsd
  3. May 14, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper

    Depending on exactly what you're doing, it could be most efficient to write your own program. If you had a large number of sets containing only integers 1-300, for example, boolean operations on bitstrings would be much faster than general-purpose implementations. A union B = A|B, A intersect B = A&B, A setminus B = A&(!B), etc.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook