Commit Graph

414 Commits

Author SHA1 Message Date
Serkan ÖZAL
7d52a37600
serkan-ozal's 4th submission: (#645)
- split big regions into shared smaller tasks, so the workers complete their own tasks can pick up from the remaining instead of leaving its core idle
- reduce number of executed instructions in the hot path
2024-01-29 21:27:06 +01:00
tivrfoa
f4a0039a59
Try more chunks than threads, and of different sizes (#644)
/**
 * Solution based on thomaswue solution, commit:
 * commit d0a28599c2
 * Author: Thomas Wuerthinger
 * Date:   Sun Jan 21 20:13:48 2024 +0100
 *
 * The goal here was to try to improve the runtime of his 10k
 * solution of: 00:04.516
 *
 * With Thomas latest changes, his time is probably much better
 * already, and maybe even 1st place for the 10k too.
 * See: https://github.com/gunnarmorling/1brc/pull/606
 *
 * But as I was already coding something, I'll submit just to
 * see if it will be faster than his *previous* 10k time of
 * 00:04.516
 *
 * Changes:
 *   It's a similar idea of my previous solution, that if you split
 * the chunks evenly, some threads might finish much faster and
 * stay idle, so:
 *   1) Create more chunks than threads, so the ones that finish first
 * can do something;
 *   2) Decrease chunk sizes as we get closer to the end of the file.
 */
2024-01-29 21:24:04 +01:00
Van Phu DO
8e407ca79d
apply loop unroll trick (#643)
* apply loop unroll trick

* less assign op, a bit faster
2024-01-29 21:21:04 +01:00
Panagiotis Drakatos
31a6740ef1
New Fresh Solution to Optimize Execution time (#641)
* CalculateAverage_pdrakatos

* Rename to be valid with rules

* CalculateAverage_pdrakatos

* Rename to be valid with rules

* Changes on scripts execution

* Fixing bugs causing scripts not to be executed

* Changes on prepare make it compatible

* Fixing passing all tests

* Increase direct memory allocation buffer

* Fixing memory problem causes heap space exception

* Fresh solution to optimize performance of the execution
2024-01-29 21:16:40 +01:00
giovannicuccu
1281e77be4
new version by Giovanni Cuccu (#640)
* Solution without unsafe

* Solution without unsafe

* Solution without unsafe, remove the usage of bytebuffer, passes the create_measurements3 test

* bug fix for 10k test, update also the CreateMeasurements3.java to use '\n' as newline instead of the os value (if it runs on windows it uses crlf and "breaks" the file format )

* new version that should perform way better than the previous one

* removed prepare script for giovannicuccu

* removed some comments

---------

Co-authored-by: Giovanni Cuccu <gcuccu@imolainformatica.it>
2024-01-29 21:12:05 +01:00
Yavuz Tas
a82cf2ceb7
improve speed, thanks to the following improvements: (#550)
* improve speed, thanks to the following improvements:
- loop unrolling and eleminating extra calculations
- eleminating instance level variable access
- quicker equals check, checking long by long chunks instead of bytes
- update GraalVM version to the latest

* faster equals check

* fix equals bug in 10K, more optimizations on equals and calculate hash parts

* New solution optimized for Linux/AMD hardware

* Optimize solution, try to fix 10K bug on native

* Optimize solution, move records to a local field

* test timing

* revert back accidentally pushed code

---------

Co-authored-by: Yavuz Tas <yavuz.tas@ing.com>
2024-01-29 21:02:20 +01:00
Marko Topolnik
886f0cdb4d
mtopolnik submission 3 (#637)
* calculate_average_mtopolnik

* short hash (just first 8 bytes of name)

* Remove unneeded checks

* Remove archiving classes

* 2x larger hashtable

* Add "set" to setters

* Simplify parsing temperature, remove newline search

* Reduce the size of the name slot

* Store name length and use to detect collision

* Reduce memory loads in parseTemperature

* Use short for min/max

* Extract constant for semicolon

* Fix script header

* Explicit bash shell in shebang

* Inline usage of broadcast semicolon

* Try vectorization

* Remove vectorization

* Go Unsafe

* Use SWAR temperature parsing by merykitty

* Inline some things

* Remove commented-out MemorySegment usage

* Inline namesMem.asSlice() invocation

* Try out JVM JIT flags

* Implement strcmp

* Remove unused instance variables

* Optimize hashing

* Put station name into hashtable

* Reorder method

* Remove usage of MemorySegment.getUtf8String

Replace with UNSAFE.copyMemory() and new String()

* Fix hashing bug

* Remove outdated comments

* Fix informative constants

* Use broadcastByte() more

* Improve method naming

* More hashing

* Revert more hashing

* Add commented-out code to hash 16 bytes

* Slight cleanup

* Align hashtable at cacheline boundary

* Add Graal Native image

* Revert Graal Native image

This reverts commit d916a42326d89bd1a841bbbecfae185adb8679d7.

* Simplify shell script (no SDK selection)

* Move a constant, zero out hashtable on start

* Better name comparison

* Add prepare_mtopolnik.sh

* Cleaner idiom in name comparison

* AND instead of MOD for hashtable indexing

* Improve word masking code

* Fix formatting

* Reduce memory loads

* Remove endianness checks

* Avoid hash == 0 problem

* Fix subtle bug

* MergeSort of parellel results

* Touch up perf

* Touch up perf

* Remove -Xmx256m

* Extract result printing method

* Print allocation details on OOME

* Single mmap

* Use global allocation arena

* Add commented-out Xmx64m XXMaxDirectMemorySize=1g

* withinSafeZone

* Update cursor earlier

* Better assert

* Fix bug in addrOfSemicolonSafe

* Move declaration lower

* Simplify code

* Add rounding error test case

* Fix DANGER_ZONE_LEN

* Deoptimize parseTemperatureSimple()

* Inline parseTemperatureAndAdvanceCursor()

* Skip masking until the last load

* Conditionally fetch name words

* Cleanup

* Use native image

* Use supbrocess

* Simpler code

* Cleanup

* Avoid extra condition on hot path
2024-01-29 20:51:52 +01:00
Artsiom Korzun
5ba094c8fd
loop similar to thomas (#634) 2024-01-29 20:36:25 +01:00
Jaime Polidura
3ed80c4b5f
Thank you for the challange!! (#599)
* added code

* Fixed pointers bugs

* removed my own benchmark

* added comment on how I handle hash collisions

* executed mwvn clean verify

* made scripts executable & fixed rounding issues

* Fixed way of dealing with hash collisions

* changed method name sameNameBytes to isSameNameBytes

* changes script from sh to bash

* fixed chunking bug

* Fixed bug in chunking when file size is too small

* added Runtime.getRuntime().availableProcessors
2024-01-28 23:31:03 +01:00
giovannicuccu
be5b3318b1
Solution without unsafe using vector API (#602)
* Solution without unsafe

* Solution without unsafe

* Solution without unsafe, remove the usage of bytebuffer, passes the create_measurements3 test

* bug fix for 10k test, update also the CreateMeasurements3.java to use '\n' as newline instead of the os value (if it runs on windows it uses crlf and "breaks" the file format )

---------

Co-authored-by: Giovanni Cuccu <gcuccu@imolainformatica.it>
2024-01-28 23:24:47 +01:00
Serkan ÖZAL
46d375e621
serkan-ozal's 3rd submission with some minor improvements: (#615)
- faster merge by ignoring empty entries in the map
- enable CDS for faster startup (added `prepare_serkan-ozal.sh` to generate CDS archive in advance)
- some tweaks with JVM options
- optimized result printing
2024-01-28 23:02:01 +01:00
Andrzej Nestoruk
ff35a4628b
anestoruk second attempt (#625)
* initial implementation

* few improvements and a cleanup (down to ~12s)

* use array instead of hashmap for collecting partial results
2024-01-28 22:59:04 +01:00
Artsiom Korzun
9282fb7b0a
processing three at once (#626) 2024-01-28 22:56:33 +01:00
Aleksey Shipilëv
82197d4482
shipilev: Amendments to version 4 (#627)
* Amendments

* One more locality touchup: no need to carry the entire name array
2024-01-28 22:49:34 +01:00
Jaromir Hamala
9da1660ba5
jerrinot - running out of ideas (#631)
* another shameless copycat from thomas: less safepoints

* I have no idea what I am doing
2024-01-28 22:43:53 +01:00
Dr Ian Preston
3a790c99b9
Reduce preferred vector size (#622)
Co-authored-by: Ian Preston <ianopolous@protonmail.com>
2024-01-28 22:39:17 +01:00
Aleksey Shipilëv
baed56bcdb
Version 4 (#183) 2024-01-28 18:36:22 +01:00
Mahadev K
f598d74594
Mahadev virtual thread 1brc (#611)
* Read file with multiple virtual threads and process chunks of file data in parallel.

* Updated logic to bucket every chunk of aggs into a vector and merge them into a TreeMap for printing.

* Virtual Thread / File Channels Impl.

* Renamed files with GHUsername.

* Added statement to get vals before updating.

* Added executable permission to the files.
2024-01-28 18:26:44 +01:00
Dimitris Karampinas
f5bddafaf7
Dkarampi solution (#614)
* Simple multi-threaded version

* Format code

* Formatted code

* More formatting
2024-01-28 18:12:54 +01:00
Van Phu DO
a33ed2181b
Use native type, remove lots of type conversions (#618)
* less type conversion, less string cast

* adjust some comments

* fixed format issue
2024-01-28 18:08:42 +01:00
Aleksei
d5854d65e6
Bytesfellow initial submittion (#619)
* Latest snapshot (#1)

preparing initial version

* Improved performance to 20seconds  (-9seconds from the previous version) (#2)

improved performance a bit

* Improved performance to 14 seconds (-6 seconds) (#3)

improved performance to 14 seconds

* sync branches (#4)

* initial commit

* some refactoring of methods

* some fixes for partitioning

* some fixes for partitioning

* fixed hacky getcode for utf8 bytes

* simplified getcode for partitioning

* temp solution with syncing

* temp solution with syncing

* new stream processing

* new stream processing

* some improvements

* cleaned stuff

* run configuration

* round buffer for the stream to pages

* not using compute since it's slower than straightforward get/put. using own byte array equals.

* using parallel gc

* avoid copying bytes when creating a station object

* formatting

* Copy less arrays. Improved performance to 12.7 seconds (-2 seconds) (#5)

* initial commit

* some refactoring of methods

* some fixes for partitioning

* some fixes for partitioning

* fixed hacky getcode for utf8 bytes

* simplified getcode for partitioning

* temp solution with syncing

* temp solution with syncing

* new stream processing

* new stream processing

* some improvements

* cleaned stuff

* run configuration

* round buffer for the stream to pages

* not using compute since it's slower than straightforward get/put. using own byte array equals.

* using parallel gc

* avoid copying bytes when creating a station object

* formatting

* some tuning to increase performance

* some tuning to increase performance

* avoid copying data; fast hashCode with slightly more collisions

* avoid copying data; fast hashCode with slightly more collisions

* cleanup (#6)

* tidy up
2024-01-28 18:06:18 +01:00
Thomas Wuerthinger
7e525c5992
Some fine tuning for thomaswue (#606)
* Some fine tuning.

* Process 2MB segments to make all threads finish at the same time.
Process with 3 scanners in parallel in the same thread.
2024-01-28 17:59:57 +01:00
Andrzej Nestoruk
b3d6659d68
anestoruk submission (#617)
* initial implementation

* few improvements and a cleanup (down to ~12s)
2024-01-28 17:12:32 +01:00
John Ziamos
97334e8621
use long for string equals (#613)
use more generic hashcode
2024-01-28 17:03:42 +01:00
Jonathan Wright
8ef22ab1bd
Initial submission for jonathan_aotearoa. (#586)
* Initial submission for jonathan_aotearoa

* Fixing typos

* Adding hyphens to prepare and calculate shell scripts so that they're aligned with my GitHub username.

* Making chunk processing more robust in attempt to fix the cause of the build error.

* Fixing typo.

* Fixed the handling of files less than 8 bytes in length.

* Additional assertion, comment improvements.

* Refactoring to improve testability. Additional assertion and comments.

* Updating collision checking to include checking if the station name is equal.

* Minor refactoring to make param ordering consistent.

* Adding a custom toString method for the results map.

* Fixing collision checking bug

* Fixing rounding bug.

* Fixing collision bug.

---------

Co-authored-by: jonathan <jonathan@example.com>
2024-01-28 16:30:22 +01:00
Serkan ÖZAL
6bd2a21686
serkan-ozal's 2nd submission with some minor improvements: (#612)
- use shared memory arena and region between worker threads
- reduce number of instructions slightly while processing file region
2024-01-28 11:56:30 +01:00
Jaromir Hamala
d9ab36a241
jerrinot's improvement (#607)
* some random changes with minimal, if any, effect

* use munmap() trick
credit: thomaswue

* some smaller tweaks

* use native image
2024-01-28 11:34:28 +01:00
PanosDR
a6cd83fc98
CalculateAverage_pdrakatos (#515)
* CalculateAverage_pdrakatos

* Rename to be valid with rules

* CalculateAverage_pdrakatos

* Rename to be valid with rules

* Changes on scripts execution

* Fixing bugs causing scripts not to be executed

* Changes on prepare make it compatible

* Fixing passing all tests

* Increase direct memory allocation buffer

* Fixing memory problem causes heap space exception
2024-01-28 10:25:53 +01:00
Alberto Venturini
936fc1da54
Second version by albertoventurini (#609)
* Contribution by albertoventurini

* Use byte arrays of size 2^20

---------

Co-authored-by: Alberto Venturini <alberto.venturini@accso.de>
2024-01-28 10:02:42 +01:00
Serkan ÖZAL
3e208be741
serkan-ozal: Initial impl (#553)
* Initial impl

* Fix bad file descriptor error in the `calculate_average_serkan-ozal.sh`

* Disable Epsilon GC and rely on default GC. Because apparently, JIT and Epsilon GC don't play well together in the eval machine for short lived Vector API's `ByteVector` objects

* Take care of byte order before processing key length with bit shift operators

* Fix key equality check for long keys
2024-01-28 09:53:09 +01:00
Dr Ian Preston
8279aa7560
Simplify dedupeStation() (#589)
13.8s locally now.

Co-authored-by: Ian Preston <ianopolous@protonmail.com>
2024-01-27 19:43:41 +01:00
tivrfoa
d9604d9258
Use LinkedBlockingQueue to process results - based on thomaswue (#603)
/**
 * Solution based on thomaswue solution, commit:
 * commit d0a28599c2
 * Author: Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
 * Date:   Sun Jan 21 20:13:48 2024 +0100
 *
 * Changes:
 *   1) Use LinkedBlockingQueue to store partial results, that
 *   will then be merged into the final map later.
 *   As different chunks finish at different times, this allows
 *   to process them as they finish, instead of joining the
 *   threads sequentially.
 *     This change seems more useful for the 10k dataset, as the
 *   runtime difference of each chunk is greater.
 *   2) Use only 4 threads if the file is >= 14GB.
 *   This showed much better results on my local test, but I only
 *   run with 200 million rows (because of limited RAM), and I have
 *   no idea how it will perform on the 1brc HW.
 */
2024-01-27 19:41:00 +01:00
Yevhenii Melnyk
a304f80710
(new submission) melgenek: ~top 15 on 10k. Buffered IO, VarHandles, vectors, custom hashtable (#600)
* melgenek: ~top 15 on 10k. Buffered IO, VarHandles, vectors, custom hashtable

* Calculate the required heap size dynamically
2024-01-27 19:37:19 +01:00
Jairo Graterón
eea9c33858
Fix hash code collisions (#605)
* fix test rounding, pass 10K station names

* improved integer conversion, delayed string creation.

* new algorithm hash, use ConcurrentHashMap

* fix rounding test

* added the length of the string in the hash initialization.

* fix hash code collisions
2024-01-27 19:32:15 +01:00
Manish Garg
5c47ce1cbd
Reading 1B row file using Java NIO lib. (#601) 2024-01-27 15:52:11 +01:00
Roy van Rijn
489ec9e3b1
Larger heap, small tweaks (#593)
More small tweaks, perf from 775~ to 738~
2024-01-27 15:24:06 +01:00
Florin Blanaru
84f6331b83
1BRC gigiblender (#595)
* Dirty implementation gigiblender

* Final impl gigiblender
2024-01-27 15:20:02 +01:00
Roman Musin
f9c58414da
Next version (#596)
* cleanup prepare script

* native image options

* fix quardaric probing (no change to perf)

* mask to get the last chunk of the name

* extract hash functions

* tweak the probing loop (-100ms)

* fiddle with native image options

* Reorder conditions in hope it makes branch predictor happier

* extracted constant
2024-01-27 15:17:55 +01:00
Van Phu DO
c228633b57
improve hard disk access locality, another 8% (#591)
* improve hard disk access locality, another 8%

* add some comments & credit

* fixed format
2024-01-27 14:54:43 +01:00
Hieu Dao Quang
5092eb44d1
First attempt with Java-managed concurrency (#590)
Co-authored-by: Quang Hieu Dao <hieu_dq@flinters.vn>
2024-01-27 14:49:59 +01:00
rcasteltrione
769884426b
Initial submission (#588)
* Initial submission

* fixed not executable scripts
2024-01-27 14:43:51 +01:00
Jason Nochlin
457a36be63
Fix hundredwatt's entry on 10k dataset (#558)
* Improve hash function

* remove limit on number of cores

* fix calculation of boundaries between chunks

* fix IOOBE

---------

Co-authored-by: Jason Nochlin <hundredwatt@users.noreply.github.com>
2024-01-26 18:22:35 +01:00
gonix
27b867d10d
CalculateAverage_gonix update (#579)
Minor updates here and there, shaves off ~5% of execution time on my machine.
2024-01-25 23:37:20 +01:00
Alberto Venturini
cb7423d386
Contribution by albertoventurini (#578)
* Contribution by albertoventurini

* Shave off a couple of hundreds of milliseconds, by making an assumption on temperature readings

* Parse reading without loop, inspired by other solutions

* Use all cores

* Small improvements, only allocate 247 positions instead of 256

---------

Co-authored-by: Alberto Venturini <alberto.venturini@accso.de>
2024-01-25 23:17:39 +01:00
Roman Stoffel
94e29982f9
Updates for gamlerhart: Simpler & Faster (#580)
* Update with Rounding Bugfix

* Simplification of Merging Results

* More Plain Java Code for Value Storage

* Improve Performance by Stupid Hash

Drop around 3 seconds on my machine by
simplifying the hash to be ridicules stupid,
but faster.

* Fix outdated comment
2024-01-25 23:12:10 +01:00
Dmitry Bufistov
b20e7365e7
Second submission to keep a bit of dignity (#581)
* Dmitry challenge

* Dmitry submit 2.

Use MemorySegment of FileChannle and Unsafe
to read bytes from disk. 4 seconds speedup in local test
from 20s to 16s.
2024-01-25 23:09:22 +01:00
Antonio Muñoz
65d2c1b0c9
tonivade improved solution (#582)
* tonivade improved not using HashMap

* use java 21.0.2

* same hash same station

* remove unused parameter in sameSation

* use length too

* refactor parallelization

* use parallel GC

* refactor

* refactor
2024-01-25 23:07:20 +01:00
Dr Ian Preston
0bd1675571
Down to 14s locally (#583)
Use flat array for stats.
Use simd for line termination

Co-authored-by: Ian Preston <ianopolous@protonmail.com>
2024-01-25 23:03:05 +01:00
Arman Sharif
d5cedd6a35
armandino: minimise hash collisions + other improvements (#585) 2024-01-25 22:59:18 +01:00
Van Phu DO
271bdfb032
Simplify Node class with less field, improve hash mix speed (#584)
* Simplify Node class with less field, improve hash mix speed

* remove some ops, a bit faster

* more inline, little bit faster but not sure
2024-01-25 22:57:04 +01:00
gabrielfoo
ce9455a584
gabrielfoo's first attempt (#556)
* first attempt

* formatting fix

---------

Co-authored-by: Gabriel <gabriel@gabriel>
2024-01-25 22:46:40 +01:00
Vemana
80cd738b4b
C style code. Should be ~4secs or lower based on local testing. (#559)
1. Use Unsafe
2. Fit hashtable in L2 cache.
3. If we can find a good hash function, it can fit in L1 cache even.
4. Improve temperature parsing by using a lookup table
2024-01-25 22:40:14 +01:00
Alexander Yastrebov
4daeb94b04
Go implementation by AlexanderYastrebov (#298)
* Go implementation by AlexanderYastrebov

This is a proof-of-concept to demonstrate non-java submission.
It requires Docker with BuildKit plugin to build and export binary.

Updates
* #67
* #253

* Use collision-free id lookup

* Use number of buckets greater than max number of keys
2024-01-23 20:49:28 +01:00
Laake Scates-Gervasi
464ba6209b
Laake Scates-Gervasi first submission (justplainlaake) [2.5s execution, locally similar time to top 5] (#431)
* Init Push

* organize imports

* Add OpenMap

* Best outcome yet

* Create prepare script and calculate script for native image, also add comments on calculation

* Remove extra hashing, and need for the set array

* Commit formatting changes from build

* Remove unneeded device information

* Make shell scripts executable, add hash collision double check for equality

* Add hash collision double check for equality

* Skip multithreading for small files to improve small file performance
2024-01-23 20:44:57 +01:00
Roy van Rijn
7ced63f460
Rewrote to always read 16 bytes, this has less instructions on perf. (#562)
It doesn't make a lot of sense since quite some code can be written shorter, but this is what gives the best numbers.
2024-01-23 20:37:09 +01:00
3j5a
a9a05599cd
CalculateAverage_3j5a off-the-shelf Java components + ArraysSupport (#566)
* off the shell Java components, curious about official runtime results. thnx

my laptop results are around 12 seconds, e.g:
87.66user 1.32system 0:12.11elapsed 734%CPU (0avgtext+0avgdata 13980924maxresident)k

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  8
  On-line CPU(s) list:   0-7
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Core(TM) i5-8400H CPU @ 2.50GHz

* off-the-shelf Java components... curious about official runtime results. thnx

laptop results are around 11 seconds, e.g:
./calculate_average_3j5a.sh  81.46s user 1.36s system 758% cpu 10.917 total

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  8
  On-line CPU(s) list:   0-7
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Core(TM) i5-8400H CPU @ 2.50GHz

* off-the-shelf Java components + ArraysSupport..

laptop results are around 10.2 seconds, e.g:
./calculate_average_3j5a.sh  75.02s user 1.31s system 750% cpu 10.175 total

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  8
  On-line CPU(s) list:   0-7
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Core(TM) i5-8400H CPU @ 2.50GHz

* method handle...

* full buffer read attempt

* MH

* MH cleanup
2024-01-23 20:31:45 +01:00
Mathias Bjerke
337642d1ec
1brc contribution from mattiz (first attempt) (#567)
* Contribution from mattiz

* Formatted code
2024-01-23 20:28:58 +01:00
karthikeyan97
292edc629f
fine tuning performance further (#526)
* final comit

changing using mappedbytebuffer

changes before using unsafe address

using unsafe

* using graalvm,correct unsafe mem implementation

---------

Co-authored-by: Karthikeyans <karthikeyan.sn@zohocorp.com>
2024-01-23 20:21:52 +01:00
Roman Musin
6c0949969a
Native image + a few smaller optimisations (#564)
* Inline parsing name and station to avoid constantly updating the offset field (-100ms)

* Remove Worker class, inline the logic into lambda

* Accumulate results in an int matrix instead of using result row (-50ms)

* Use native image
2024-01-23 20:19:07 +01:00
yourwass
ba793e88cd
Add Yourwass take on the challenge (#532)
* Uses vector api for city name parsing and for hash index collision resolution
* Uses lookup tables for temperature parsing
2024-01-23 20:04:55 +01:00
Yann Moisan
b3420d9348
improvements (#521)
- inline computeIfAbsent
- replace arraycopy by copyOfRange

Co-authored-by: Yann Moisan <yann@zen.ly>
2024-01-23 19:58:10 +01:00
Parker Timmins
c886aaba34
Deploy v2 for parkertimmins (#524)
* Deploy v2 for parkertimmins

Main changes:
- fix hash which masked incorrectly
- do station equality check in simd
- make station array length multiple of 32
- search for newline rather than semicolon

* Fix bug - entries were being skipped between batches

At the boundary between two batches, the first batch would stop after
crossing a limit with a padding of 200 characters applied. The next
batch should then start looking for the first full entry after the
padding. This padding logic had been removed when starting a batch. For
this reason, entries starting in the 200 character padding between
batches were skipped.
2024-01-23 19:43:34 +01:00
Artsiom Korzun
d858959097
parse value before going to map (#548)
parse value before going to map
2024-01-23 19:38:32 +01:00
Gaurav Anantrao Deshmukh
46d2058bd4
First optimal solution attempt (#539)
* First optimal attempt

* Removing debug lines

* Using default string equals method

---------

Co-authored-by: Gaurav Deshmukh <deshmgau@amazon.com>
2024-01-23 19:32:03 +01:00
Jeevjyot Singh Chhabda
415b3eb5c5
b1rc challenge by @jeevjyot (#551)
* b1rc challenge

* fixed a rounding error

* added the file back

* fixed file

* removed a file

---------

Co-authored-by: Jeevjyot Singh Chhabda <jeevjyotsinghchhabda@Jeevjyots-MBP.hsd1.ca.comcast.net>
2024-01-23 18:43:58 +01:00
Jaromir Hamala
2c432abb96
jerrinot's improvement - fast-path for short keys (#545)
* fast-path for keys<16 bytes

* fix off by one error

the mask is wrong for he 2nd word when len == 16

* less chunks per thread

seems like compact code wins. on my test box anyway.
2024-01-23 18:29:22 +01:00
Marek Kohn
2be84e09ee
Add 1brc solution by @makohn (#544) 2024-01-23 18:26:53 +01:00
Van Phu DO
98a8279669
use thomaswue trick, use parallelism, slightly faster (#560) 2024-01-23 16:41:25 +01:00
Dr Ian Preston
8bae1b8781
Use simd for name comparison (#568)
Co-authored-by: Ian Preston <ianopolous@protonmail.com>
2024-01-23 16:37:33 +01:00
Antonio Muñoz
f7febea2f6
tonivade implementation (try 2) (#541)
* tonivade implementation

* synchronized block performs better than ReentrantLock

* remove ConcurrentHashMap

* refactor

* use HashMap.newHashMap

* change double to int

* minor refactor

* fix
2024-01-23 16:35:05 +01:00
Elliot Barlas
df891354d3
Inline and optimize value parsing code for each of the four semicolon position processing branches. This provides a small but noticeable speed-up. It also expands and obfuscates the code, unfortunately. (#563) 2024-01-23 16:31:04 +01:00
Li Lin
d2639b7ce1
Add linl33's implementation (#503)
* Add linl33's implementation

* Update evaluate.sh

---------

Co-authored-by: Gunnar Morling <gunnar.morling@googlemail.com>
2024-01-21 21:14:05 +01:00
Artsiom Korzun
ac4805ee45
subprocess spawner (#542) 2024-01-21 20:23:48 +01:00
Roy van Rijn
d8b071c878
Reverting ByteBuffer idea, using Thomas's trick instead. (#538) 2024-01-21 20:15:07 +01:00
Thomas Wuerthinger
d0a28599c2
Tuning and subprocess spawn for thomaswue (#533)
* Some clean up, small-scale tuning, and reduce complexity when handling longer names.

* Do actual work in worker subprocess. Main process returns immediately
and OS clean up of the mmap continues in the subprocess.

* Update minor Graal version after CPU release.

* Turn GC back to epsilon GC (although it does not seem to make a
difference).

* Minor tuning for another +1%.
2024-01-21 20:13:48 +01:00
Artsiom Korzun
6b95ac6113
optimize branches (#534) 2024-01-21 19:54:43 +01:00
Elliot Barlas
47269cf30b
Adjust rolling hash function to operate at int-scale rather than byte-scale. Ensure 8-byte alignment in key buffer for faster comparisons. (#523) 2024-01-21 19:38:32 +01:00
Roman Musin
7bfc7eaec6
Reduce allocations and heap size (#525)
* Reduce allocations

* Shrink the heap size

* Calculate hash when reading name  (50-100ms difference)

* no need to reverse bytes

* bump heap size
2024-01-21 18:01:23 +01:00
Van Phu DO
410425c833
reorganize code, little bit faster (#509) 2024-01-21 13:25:18 +01:00
kumarsaurav123
8ba67cbc6d
Use Array to store results instead of grouping by and custom class (#522) 2024-01-21 12:50:36 +01:00
adri
0a7726cc64
Improving first iteration by avoiding string creation as much as possible (#516)
- It avoids creating unnecessary Strings objects and handles with the station names with its djb2 hashes instead
- Initializes hashmaps with capacity and load factor
- Adds -XX:+AlwaysPreTouch
2024-01-20 21:27:34 +01:00
giovannicuccu
2c1264def9
Solution without unsafe (#507)
Co-authored-by: Giovanni Cuccu <gcuccu@imolainformatica.it>
2024-01-20 21:01:43 +01:00
Shivam Agarwal
f06de5faab
Add 0xshivamagarwal Implementation (#508)
* 0xshivamagarwal implementation

* .

---------

Co-authored-by: Shivam Agarwal <>
2024-01-20 20:54:04 +01:00
karthikeyan97
f49a92019e
using unsafe alone (#512)
* final comit

changing using mappedbytebuffer

changes before using unsafe address

using unsafe

* using graalvm,correct unsafe mem implementation

---------

Co-authored-by: Karthikeyans <karthikeyan.sn@zohocorp.com>
2024-01-20 20:49:54 +01:00
Yann Moisan
ac26c8b644
Improved version based on rafaelmerino (#511)
* files created by create_fork.sh

* use indexOf

* improved implementation based on rafaelmerino

---------

Co-authored-by: Yann Moisan <yann@zen.ly>
2024-01-20 20:33:14 +01:00
Roman Musin
9100ed6316
Epsilon GC + a number of other small tweaks (#513)
* Version 3

* Use SWAR algorithm from netty for finding a symbol in a string

* Faster equals - store the remainder in a long field (- 0.5s)

* optimise parsing numbers - prep

* Keep tweaking parsing logic

* Rewrote number parsing

may be a tiby bit faster it at all

* Epsilon GC
2024-01-20 20:30:25 +01:00
Dr Ian Preston
062f2bbecf
Introducing the vector api. 1s faster on 4 core i7 (#506)
Co-authored-by: Ian Preston <ianopolous@protonmail.com>
2024-01-20 20:09:40 +01:00
Jaromir Hamala
114ba76d20
jerrinot's improvement (#514)
* refactoring

* segregated heap for names

also a different hashing function. turns out hashing just first word is good enough
2024-01-20 20:06:31 +01:00
Yonatan Graber
e1a0b79259
yonatang solution: a jdk8 friendly, no unsafe code, epsilon-gc friendly solution (#499)
* 1bc challenge, but one that will run using jdk 8 without unsafe and still do reasonably well.

* Better hashtable

* the fastest GC is no GC

* cleanups

* increased hash size

* removed Playground.java

* collision-handling allocation free hashmap

* formatting
2024-01-20 15:02:55 +01:00
Xylitol
8353a1cb3d
Processing byte array backwards (#504) 2024-01-20 14:04:19 +01:00
Elliot Barlas
eaf87689f5
Use Arena MemorySegments rather than ByteBuffers. (#505) 2024-01-20 13:56:27 +01:00
Roy van Rijn
7c983f3d66
Added dedicated reader (#493)
Started running perf, perhaps this helps. No idea how to use it yet
2024-01-19 22:15:49 +01:00
Juan Parera
f409fe0815
Change data storage improving memory locality (#496) 2024-01-19 22:06:48 +01:00
Van Phu DO
e67920f4af
low collision + fast mixer, more optimization, less if because if is slow (#474) 2024-01-19 22:03:51 +01:00
Artsiom Korzun
586def3620
plain old io (#492)
plain old io
2024-01-19 21:52:55 +01:00
Vemana
6e3893c6a6
Reduce variance by (1) Using common chunks at the end (2) Busy looping (#486)
on automatic closing of ByteBuffers.. previously, a straggler could hold
up closing the ByteBuffers.

Also
- Improve Tracing code
- Parametrize additional options to aid in tuning

Our previous PR was surprising; parallelizing munmap() call did not
yield anywhere near the performance gain I expected. Local machine had
10% gain while testing machine only showed 2% gain. I am still not clear
why it happened and the two best theories I have are
1) Variance due to stragglers (that this change addresses)
2) munmap() is either too fast or too slow relative to the other
   instructions compared to our local machine. I don't know which. We'll
   have to use adaptive tuning, but that's in a different change.
2024-01-19 21:47:55 +01:00
Eve
144a6af164
netrunnereve: more optimizations (#485) 2024-01-19 21:44:22 +01:00
Jin Cong Ho
ce8fe41bd4
Submission #3: jincongho (#482) 2024-01-19 21:40:05 +01:00
kumarsaurav123
f6bcaae4b9
kumarsaurav123 # Attempt 3 (#470)
* Use Memory Segment

* Reduce Number of threads
2024-01-19 21:35:25 +01:00
Antonio Goncalves
836f0805ad
GitHub Copilot Chat with the help of agoncal (#460)
* v1 - Initial prompt

* Introduce Records

* v1 - Initial prompt

* v2 - Introduce Records

* v3 - Improves code

* v4 - Improves JVM parameter

* GitHub Copilot Chat with the help of agoncal

* Format

* Pass measurements-rounding

* Added prepare script
2024-01-19 21:26:12 +01:00