Leaderboard update
This commit is contained in:
parent
c3411f6023
commit
88b1c30db8
27
README.md
27
README.md
@ -38,19 +38,20 @@ Submit your implementation by Jan 31 2024 and become part of the leaderboard!
|
|||||||
| # | Result (m:s.ms) | Implementation | JDK | Submitter |
|
| # | Result (m:s.ms) | Implementation | JDK | Submitter |
|
||||||
|---|-----------------|--------------------|-----|---------------|
|
|---|-----------------|--------------------|-----|---------------|
|
||||||
| 1.| 00:14.848| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_spullara.java)| 21.0.1-graalce| [Sam Pullara](https://github.com/spullara)|
|
| 1.| 00:14.848| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_spullara.java)| 21.0.1-graalce| [Sam Pullara](https://github.com/spullara)|
|
||||||
| 2.| 00:18.865| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_palmr.java)| 21.0.1-open| [Nick Palmer](https://github.com/palmr)|
|
| 2.| 00:17.905| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_lawrey.java)| 21.0.1-open| [Peter Lawrey](https://github.com/peter-lawrey)|
|
||||||
| 3.| 00:21.853| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_filiphr.java)| 21.0.1-graal| [Filip Hrisafov](https://github.com/filiphr)|
|
| 3.| 00:18.865| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_palmr.java)| 21.0.1-open| [Nick Palmer](https://github.com/palmr)|
|
||||||
| 4.| 00:23.366| [link](https://github.com/gunnarmorling/1brc/pull/5/)| 21.0.1-open | [Roy van Rijn](https://github.com/royvanrijn)|
|
| 4.| 00:21.853| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_filiphr.java)| 21.0.1-graal| [Filip Hrisafov](https://github.com/filiphr)|
|
||||||
| 5.| 00:38.106| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_seijikun.java)| 21.0.1-open | [Markus Ebner](https://github.com/seijikun)|
|
| 5.| 00:23.260| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_richardstartin.java)| 21.0.1-open | [Richard Startin](https://github.com/richardstartin)|
|
||||||
| 6.| 00:38.510| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_bjhara.java)| 21.0.1-open | [Hampus Ram](https://github.com/bjhara)|
|
| 6.| 00:23.366| [link](https://github.com/gunnarmorling/1brc/pull/5/)| 21.0.1-open | [Roy van Rijn](https://github.com/royvanrijn)|
|
||||||
| 7.| 00:38.819| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_richardstartin.java)| 21.0.1-open | [Richard Startin](https://github.com/richardstartin)|
|
| 7.| 00:38.106| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_seijikun.java)| 21.0.1-open | [Markus Ebner](https://github.com/seijikun)|
|
||||||
| 8.| 00:50.547| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_padreati.java)| 21.0.1-open | [Aurelian Tutuianu](https://github.com/padreati)|
|
| 8.| 00:38.510| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_bjhara.java)| 21.0.1-open | [Hampus Ram](https://github.com/bjhara)|
|
||||||
| 9.| 00:53.679| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_criccomini.java)| 21.0.1-open | [Chris Riccomini](https://github.com/criccomini)|
|
| 9.| 00:50.547| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_padreati.java)| 21.0.1-open | [Aurelian Tutuianu](https://github.com/padreati)|
|
||||||
|10.| 00:57.141| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_truelive.java)| 21.0.1-open | [Roman Schweitzer](https://github.com/truelive)|
|
|10.| 00:53.679| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_criccomini.java)| 21.0.1-open | [Chris Riccomini](https://github.com/criccomini)|
|
||||||
|11.| 02:00.101| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_khmarbaise.java)| 21.0.1-open | [khmarbaise](https://github.com/khmarbaise)|
|
|11.| 00:57.141| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_truelive.java)| 21.0.1-open | [Roman Schweitzer](https://github.com/truelive)|
|
||||||
|12.| 02:08.315| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_itaske.java)| 21.0.1-open | [itaske](https://github.com/itaske)|
|
|12.| 02:00.101| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_khmarbaise.java)| 21.0.1-open | [khmarbaise](https://github.com/khmarbaise)|
|
||||||
|13.| 02:08.650| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_kuduwa_keshavram.java)| 21.0.1-open | [Kuduwa Keshavram](https://github.com/kuduwa_keshavram)|
|
|13.| 02:08.315| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_itaske.java)| 21.0.1-open | [itaske](https://github.com/itaske)|
|
||||||
|14.| 04:13.449| [link](https://github.com/gunnarmorling/onebrc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage.java) (baseline)| 21.0.1-open | [Gunnar Morling](https://github.com/gunnarmorling)|
|
|14.| 02:08.650| [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_kuduwa_keshavram.java)| 21.0.1-open | [Kuduwa Keshavram](https://github.com/kuduwa_keshavram)|
|
||||||
|
|15.| 04:13.449| [link](https://github.com/gunnarmorling/onebrc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage.java) (baseline)| 21.0.1-open | [Gunnar Morling](https://github.com/gunnarmorling)|
|
||||||
|
|
||||||
See [below](#entering-the-challenge) for instructions how to enter the challenge with your own implementation.
|
See [below](#entering-the-challenge) for instructions how to enter the challenge with your own implementation.
|
||||||
|
|
||||||
|
1
pom.xml
1
pom.xml
@ -185,6 +185,7 @@
|
|||||||
<exclude>**/.dontdelete</exclude>
|
<exclude>**/.dontdelete</exclude>
|
||||||
<exclude>**/measurements*.txt</exclude>
|
<exclude>**/measurements*.txt</exclude>
|
||||||
<exclude>**/measurements*.out</exclude>
|
<exclude>**/measurements*.out</exclude>
|
||||||
|
<exclude>out_expected.txt</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
@ -159,7 +159,8 @@ public class CalculateAverage_lawrey {
|
|||||||
m.sample(temp / 10.0);
|
m.sample(temp / 10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
}
|
||||||
|
catch (IOException ioe) {
|
||||||
throw new RuntimeException(ioe);
|
throw new RuntimeException(ioe);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@ -169,8 +170,7 @@ public class CalculateAverage_lawrey {
|
|||||||
private static int readTemperatureFromBuffer(MappedByteBuffer mbb) {
|
private static int readTemperatureFromBuffer(MappedByteBuffer mbb) {
|
||||||
int temp = 0;
|
int temp = 0;
|
||||||
boolean negative = false;
|
boolean negative = false;
|
||||||
outer:
|
outer: while (mbb.remaining() > 0) {
|
||||||
while (mbb.remaining() > 0) {
|
|
||||||
byte b = mbb.get();
|
byte b = mbb.get();
|
||||||
switch (b) {
|
switch (b) {
|
||||||
case '-':
|
case '-':
|
||||||
|
@ -87,8 +87,7 @@ public class CalculateAverage_richardstartin {
|
|||||||
|
|
||||||
private final Table table = new Table(nextBaseIndex());
|
private final Table table = new Table(nextBaseIndex());
|
||||||
|
|
||||||
private static final AtomicIntegerFieldUpdater<Dictionary> BASE_INDEX_UPDATER =
|
private static final AtomicIntegerFieldUpdater<Dictionary> BASE_INDEX_UPDATER = AtomicIntegerFieldUpdater.newUpdater(Dictionary.class, "baseIndex");
|
||||||
AtomicIntegerFieldUpdater.newUpdater(Dictionary.class, "baseIndex");
|
|
||||||
volatile int baseIndex;
|
volatile int baseIndex;
|
||||||
|
|
||||||
private void forEach(Table table, IndexedStringConsumer consumer) {
|
private void forEach(Table table, IndexedStringConsumer consumer) {
|
||||||
@ -120,13 +119,15 @@ public class CalculateAverage_richardstartin {
|
|||||||
if (storedKey == null) {
|
if (storedKey == null) {
|
||||||
if (row.keys.compareAndSet(c, null, slice)) {
|
if (row.keys.compareAndSet(c, null, slice)) {
|
||||||
return table.index(rowIndex, c);
|
return table.index(rowIndex, c);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
storedKey = row.keys.get(c);
|
storedKey = row.keys.get(c);
|
||||||
if (slice.equals(storedKey)) {
|
if (slice.equals(storedKey)) {
|
||||||
return table.index(rowIndex, c);
|
return table.index(rowIndex, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (slice.equals(storedKey)) {
|
}
|
||||||
|
else if (slice.equals(storedKey)) {
|
||||||
return table.index(rowIndex, c);
|
return table.index(rowIndex, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,8 +142,7 @@ public class CalculateAverage_richardstartin {
|
|||||||
|
|
||||||
private static final class Row {
|
private static final class Row {
|
||||||
|
|
||||||
private static final AtomicReferenceFieldUpdater<Row, Table>
|
private static final AtomicReferenceFieldUpdater<Row, Table> NEXT_TABLE_UPDATER = AtomicReferenceFieldUpdater.newUpdater(Row.class, Table.class, "next");
|
||||||
NEXT_TABLE_UPDATER = AtomicReferenceFieldUpdater.newUpdater(Row.class, Table.class, "next");
|
|
||||||
private final AtomicReferenceArray<ByteBuffer> keys = new AtomicReferenceArray<>(CELLS);
|
private final AtomicReferenceArray<ByteBuffer> keys = new AtomicReferenceArray<>(CELLS);
|
||||||
volatile Table next;
|
volatile Table next;
|
||||||
|
|
||||||
@ -152,7 +152,8 @@ public class CalculateAverage_richardstartin {
|
|||||||
Table newTable = new Table(baseIndexSupplier.getAsInt());
|
Table newTable = new Table(baseIndexSupplier.getAsInt());
|
||||||
if (NEXT_TABLE_UPDATER.compareAndSet(this, null, newTable)) {
|
if (NEXT_TABLE_UPDATER.compareAndSet(this, null, newTable)) {
|
||||||
next = newTable;
|
next = newTable;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
next = this.next;
|
next = this.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,14 +181,16 @@ public class CalculateAverage_richardstartin {
|
|||||||
private static long compilePattern(long repeat) {
|
private static long compilePattern(long repeat) {
|
||||||
return 0x101010101010101L * repeat;
|
return 0x101010101010101L * repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long compilePattern(char delimiter) {
|
private static long compilePattern(char delimiter) {
|
||||||
return compilePattern (delimiter & 0xFFL);
|
return compilePattern(delimiter & 0xFFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long compilePattern(byte delimiter) {
|
private static long compilePattern(byte delimiter) {
|
||||||
return compilePattern(delimiter & 0xFFL);
|
return compilePattern(delimiter & 0xFFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long NEW_LINE = compilePattern((byte)'\n');
|
private static final long NEW_LINE = compilePattern((byte) '\n');
|
||||||
private static final long DELIMITER = compilePattern(';');
|
private static final long DELIMITER = compilePattern(';');
|
||||||
|
|
||||||
private static int firstInstance(long word, long pattern) {
|
private static int firstInstance(long word, long pattern) {
|
||||||
@ -311,11 +314,12 @@ public class CalculateAverage_richardstartin {
|
|||||||
for (int i = 0; i < contribution.length; i++) {
|
for (int i = 0; i < contribution.length; i++) {
|
||||||
if (aggregate[i] == null) {
|
if (aggregate[i] == null) {
|
||||||
aggregate[i] = contribution[i];
|
aggregate[i] = contribution[i];
|
||||||
} else if (contribution[i] != null) {
|
}
|
||||||
|
else if (contribution[i] != null) {
|
||||||
double[] to = aggregate[i];
|
double[] to = aggregate[i];
|
||||||
double[] from = contribution[i];
|
double[] from = contribution[i];
|
||||||
// todo won't vectorise - consider separating aggregates into distinct regions and apply
|
// todo won't vectorise - consider separating aggregates into distinct regions and apply
|
||||||
// loop fission (if this shows up in the profile)
|
// loop fission (if this shows up in the profile)
|
||||||
for (int j = 0; j < to.length; j += 4) {
|
for (int j = 0; j < to.length; j += 4) {
|
||||||
to[j] += from[j];
|
to[j] += from[j];
|
||||||
to[j + 1] = Math.min(to[j + 1], from[j + 1]);
|
to[j + 1] = Math.min(to[j + 1], from[j + 1]);
|
||||||
@ -334,7 +338,8 @@ public class CalculateAverage_richardstartin {
|
|||||||
var slice = slices.get(min);
|
var slice = slices.get(min);
|
||||||
computeSlice(slice, pages);
|
computeSlice(slice, pages);
|
||||||
return pages;
|
return pages;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
int mid = (min + max) / 2;
|
int mid = (min + max) / 2;
|
||||||
var low = new AggregationTask(dictionary, slices, min, mid);
|
var low = new AggregationTask(dictionary, slices, min, mid);
|
||||||
var high = new AggregationTask(dictionary, slices, mid + 1, max);
|
var high = new AggregationTask(dictionary, slices, mid + 1, max);
|
||||||
@ -349,7 +354,7 @@ public class CalculateAverage_richardstartin {
|
|||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
int maxChunkSize = 250 << 20; // 250MiB
|
int maxChunkSize = 250 << 20; // 250MiB
|
||||||
try (var raf = new RandomAccessFile(FILE, "r");
|
try (var raf = new RandomAccessFile(FILE, "r");
|
||||||
var channel = raf.getChannel()) {
|
var channel = raf.getChannel()) {
|
||||||
long size = channel.size();
|
long size = channel.size();
|
||||||
// make as few mmap calls as possible subject to the 2GiB limit per buffer
|
// make as few mmap calls as possible subject to the 2GiB limit per buffer
|
||||||
List<ByteBuffer> rawBuffers = new ArrayList<>();
|
List<ByteBuffer> rawBuffers = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user