Skip to content

Commit

Permalink
Merge pull request #9 from binpash/uniq-ips
Browse files Browse the repository at this point in the history
Add uniq-ips benchmark
  • Loading branch information
vagos authored Oct 7, 2024
2 parents f16b7e6 + d202d9c commit c4c5bc2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions uniq-ips/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt
1 change: 1 addition & 0 deletions uniq-ips/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm *.txt
3 changes: 3 additions & 0 deletions uniq-ips/inputs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
N=40000000 # 40M

./scripts/gen_data.py "$N" > logs-popcount-org.txt
1 change: 1 addition & 0 deletions uniq-ips/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cat "logs-popcount-org.txt" | sort | uniq > "out.txt"
28 changes: 28 additions & 0 deletions uniq-ips/scripts/gen_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
import sys
import random

# Function to generate a random IP address
def generate_ip():
return ".".join(str(random.randint(0, 255)) for _ in range(4))

# Function to generate random data with IP addresses and datacenter numbers
def generate_data():
ip = generate_ip()
num = random.randint(1, 200)
line = f"{ip} {num}"
return line

def main():
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <number of data points>", file=sys.stderr)
sys.exit(1)

random.seed(42)
n = sys.argv[1]
n = int(n)
for _ in range(n):
print(generate_data())

if __name__ == "__main__":
main()
Empty file added uniq-ips/verify.sh
Empty file.

0 comments on commit c4c5bc2

Please sign in to comment.