-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
385 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
tmp/* | ||
data/* | ||
benchmarks/* | ||
*.txt | ||
*.log |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# Declare an array of version tags | ||
declare -a versions=("v0.0.2" "v0.0.3") # Add your arbitrary versions here | ||
|
||
# Create a directory to hold the benchmark results | ||
mkdir -p benchmarks | ||
|
||
# Run benchmarks for each version | ||
for version in "${versions[@]}"; do | ||
echo "Checking out version: $version" | ||
git checkout $version | ||
|
||
echo "Running benchmarks for version: $version" | ||
go test -run='^$' -bench=. -count=6 > "benchmarks/${version}" | ||
done | ||
|
||
# Checkout the main branch again | ||
git checkout main | ||
|
||
# Generate the benchstat comparison command with all the .txt files | ||
benchstat_cmd="benchstat " | ||
for version in "${versions[@]}"; do | ||
benchstat_cmd+=" benchmarks/${version}" | ||
done | ||
|
||
# Execute the comparison command and save it as a CSV | ||
echo "Comparing all versions with benchstat..." | ||
eval "$benchstat_cmd" > "benchmarks/combined_benchmarks_comparison" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package storage | ||
|
||
// Convert an Event to an EventProto | ||
func convertToProtoEvent(ev Event) *EventProto { | ||
return &EventProto{ | ||
Key: ev.Key, | ||
EventHash: ev.EventHash[:], | ||
Level: ev.Level, | ||
ContentHashes: hashesToBytes(ev.ContentHashes), | ||
MetadataHashes: hashesToBytes(ev.MetadataHashes), | ||
HashOfParentEvent: ev.HashOfParentEvent[:], | ||
HashOfRootEvent: ev.HashOfRootEvent[:], | ||
Temporary: ev.Temporary, | ||
FullTextSearch: ev.FullTextSearch, | ||
} | ||
} | ||
|
||
// Convert an EventProto to an Event | ||
func convertFromProtoEvent(pbEvent *EventProto) Event { | ||
return Event{ | ||
Key: pbEvent.GetKey(), | ||
EventHash: bytesToHash(pbEvent.GetEventHash()), | ||
Level: pbEvent.GetLevel(), | ||
ContentHashes: bytesToHashes(pbEvent.GetContentHashes()), | ||
MetadataHashes: bytesToHashes(pbEvent.GetMetadataHashes()), | ||
HashOfParentEvent: bytesToHash(pbEvent.GetHashOfParentEvent()), | ||
HashOfRootEvent: bytesToHash(pbEvent.GetHashOfRootEvent()), | ||
Temporary: pbEvent.GetTemporary(), | ||
FullTextSearch: pbEvent.GetFullTextSearch(), | ||
} | ||
} | ||
|
||
// Convert a slice of [64]byte hashes to a slice of byte slices | ||
func hashesToBytes(hashes [][64]byte) [][]byte { | ||
result := make([][]byte, len(hashes)) | ||
for i, hash := range hashes { | ||
result[i] = hash[:] | ||
} | ||
return result | ||
} | ||
|
||
// Convert a slice of byte slices to a slice of [64]byte hashes | ||
func bytesToHashes(byteSlices [][]byte) [][64]byte { | ||
hashes := make([][64]byte, len(byteSlices)) | ||
for i, bytes := range byteSlices { | ||
copy(hashes[i][:], bytes) | ||
} | ||
return hashes | ||
} | ||
|
||
// Convert a byte slice to a [64]byte hash | ||
func bytesToHash(b []byte) [64]byte { | ||
var hash [64]byte | ||
copy(hash[:], b) | ||
return hash | ||
} |
Oops, something went wrong.