1brc
1brc copied to clipboard
create_fork.sh: Script to Create a New Fork
I was doing this manually a bunch so I could compare changes to my own entry, so created this script. It will also work for new entrants.
Usage: create_fork.sh [-s <source fork>] <fork name>
-s <source fork> The name of the fork to copy from (default: baseline)
<fork name> The name of the fork to create
meat of it is:
cp prepare_$SOURCE_FORK.sh prepare_$FORK.sh
cp calculate_average_$SOURCE_FORK.sh calculate_average_$FORK.sh
substitute_in_file $SOURCE_FORK $FORK calculate_average_$FORK.sh
if [ $SOURCE_FORK == "baseline" ]; then
cp src/main/java/dev/morling/onebrc/CalculateAverage.java src/main/java/dev/morling/onebrc/CalculateAverage_$FORK.java
substitute_in_file CalculateAverage CalculateAverage_$FORK src/main/java/dev/morling/onebrc/CalculateAverage_$FORK.java
else
cp src/main/java/dev/morling/onebrc/CalculateAverage_$SOURCE_FORK.java src/main/java/dev/morling/onebrc/CalculateAverage_$FORK.java
substitute_in_file $SOURCE_FORK $FORK src/main/java/dev/morling/onebrc/CalculateAverage_$FORK.java
fi
Nice! Wanna add a mention of it in the README, somewhere in "Entering the Challenge"?
Don't want to poop the party but its just two files really.
If we'd have ./forks/<foo>/
structure then it would be just cp -R ./forks/baseline ./forks/<githubid>
@AlexanderYastrebov, well, the actual Java file couldn't live in that dir?
@gunnarmorling Yes, indeed - that's another potential improvement change src/main/java/dev/morling/onebrc/CalculateAverage_foo.java
to src/main/java/dev/morling/onebrc/foo/CalculateAverage.java
.
It will give better package isolation and will allow multiple java files avoiding a mess.
Also by now 57 participants somehow figured it out :)
@gunnarmorling I updated the README and made a few other tweaks 👍
Sweet! Merged, thx.