MinHashCollections { public void add(long item,long user,long time) { if (!mhcs.containsKey(item)) mhcs.putIfAbsent(item, new MinHashCollection(mhFactory.create(window))); MinHashCollection mhc = mhcs.get(item); mhc.add(user, time); } MinHashCollections(MinHasherFactory mhFactory,long window,int minActivity); void add(long item,long user,long time); List<State> getAllMinHashes(long time);  }
@Test public void speedTest() { Set<Hasher> existing = new HashSet<>(); for(int i=0;i<100;i++) { Hasher h = SimplePrimeHash.create(existing); existing.add(h); } List<Hasher> hashes = new ArrayList<Hasher>(existing); MinHasherFactory f = new RollingWindowedMinHashFactory(hashes); MinHashCollections mhcs = new MinHashCollections(f, 10000, 0); Random r = new Random(); long s1 = System.currentTimeMillis(); int timeSteps = 100000; for(int i=1;i<timeSteps;i++) { int itemId = r.nextInt(200); int userId = r.nextInt(999999); mhcs.add(itemId, userId, i); } long s2 = System.currentTimeMillis(); long t = s2-s1; double reqPerSec = timeSteps/(t/1000.0); System.out.println("time:"+t+" per sec "+reqPerSec); }