ByteVertex(long id, LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx) { super(id); this.tx = tx; this.set = (SortedSet<ByteEntry>) tx.get(id); }
ByteVertex(long id, LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx) { super(id); this.tx = tx; this.set = tx.get(id); }
private static long testByte() { LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx = new LongObjectHashMap<ConcurrentSkipListSet<ByteEntry>>(NUM); for (int i = 0; i < NUM; i++) { tx.put(i, new ConcurrentSkipListSet<ByteEntry>()); } for (int i = 0; i < NUM; i++) { for (int j = 0; j < NUM; j++) { if (i == j) continue; if (Math.random() < FRACTION) { ByteBuffer key = ByteBuffer.allocate(16); key.putLong(5).putLong(j).flip(); ByteBuffer value = ByteBuffer.allocate(4); value.putInt(random.nextInt(ROUNDSIZE)).flip(); tx.get(i).add(new ByteEntry(key, value)); } } } long time = System.currentTimeMillis(); long sum = 0; for (int t = 0; t < TRIALS; t++) { for (int i = 0; i < NUM; i++) { for (Vertex v : (new ByteVertex(i, tx)).getNeighbors(0)) { sum += v.getId(); } } } time = System.currentTimeMillis() - time; return time; }
private static long testByte() { final LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx = new LongObjectHashMap<>(NUM); for (int i = 0; i < NUM; i++) { tx.put(i, new ConcurrentSkipListSet<>()); } for (int i = 0; i < NUM; i++) { for (int j = 0; j < NUM; j++) { if (i == j) continue; if (Math.random() < FRACTION) { ByteBuffer key = ByteBuffer.allocate(16); key.putLong(5).putLong(j).flip(); ByteBuffer value = ByteBuffer.allocate(4); value.putInt(random.nextInt(ROUNDSIZE)).flip(); tx.get(i).add(new ByteEntry(key, value)); } } } long time = System.currentTimeMillis(); long sum = 0; for (int t = 0; t < TRIALS; t++) { for (int i = 0; i < NUM; i++) { for (Vertex v : (new ByteVertex(i, tx)).getNeighbors(0)) { sum += v.getId(); } } } time = System.currentTimeMillis() - time; return time; }
ByteVertex(long id, LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx) { super(id); this.tx = tx; this.set = (SortedSet<ByteEntry>) tx.get(id); }
@Override public Object getEntry(final Object externalId) { return map.get(getID(externalId)); }
@Override public Object getEntry(final Object externalId) { return map.get(getID(externalId)); }
/** * Retrieve the Object associated with each long from {@code map}. If it * is an {@code instanceof Vertex}, then replace it in the map with * {@link Vertex#getId()}. Otherwise, do nothing. */ @Override public void apply(long l) { final Object o = map.get(l); assert null != o; if (o instanceof Vertex) { map.put(l, ((Vertex) o).getId()); } } }
/** * Retrieve the Object associated with each long from {@code map}. If it * is an {@code instanceof Vertex}, then replace it in the map with * {@link Vertex#id()}. Otherwise, do nothing. */ @Override public void apply(final long l) { final Object o = map.get(l); assert null != o; if (o instanceof Vertex) { map.put(l, ((Vertex) o).id()); } } }
private static long testByte() { LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx = new LongObjectOpenHashMap<ConcurrentSkipListSet<ByteEntry>>(NUM); for (int i = 0; i < NUM; i++) { tx.put(i, new ConcurrentSkipListSet<ByteEntry>()); } for (int i = 0; i < NUM; i++) { for (int j = 0; j < NUM; j++) { if (i == j) continue; if (Math.random() < FRACTION) { ByteBuffer key = ByteBuffer.allocate(16); key.putLong(5).putLong(j).flip(); ByteBuffer value = ByteBuffer.allocate(4); value.putInt(random.nextInt(ROUNDSIZE)).flip(); tx.get(i).add(new ByteEntry(key, value)); } } } long time = System.currentTimeMillis(); long sum = 0; for (int t = 0; t < TRIALS; t++) { for (int i = 0; i < NUM; i++) { for (Vertex v : (new ByteVertex(i, tx)).getNeighbors(0)) { sum += v.getId(); } } } time = System.currentTimeMillis() - time; return time; }
Future<Page> pageFuture = loadingPages.get(pageOffset);