aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/utils/speed-regression.tcl
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:52:54 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:52:54 +0100
commitdcacc00e3750300617ba6e16eb346713f91a783a (patch)
tree38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/redis-unstable/utils/speed-regression.tcl
parent58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff)
downloadcrep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz
Remove testing data
Diffstat (limited to 'examples/redis-unstable/utils/speed-regression.tcl')
-rwxr-xr-xexamples/redis-unstable/utils/speed-regression.tcl133
1 files changed, 0 insertions, 133 deletions
diff --git a/examples/redis-unstable/utils/speed-regression.tcl b/examples/redis-unstable/utils/speed-regression.tcl
deleted file mode 100755
index 62b5ec8..0000000
--- a/examples/redis-unstable/utils/speed-regression.tcl
+++ /dev/null
@@ -1,133 +0,0 @@
1#!/usr/bin/env tclsh8.5
2# Copyright (C) 2011-Present Redis Ltd. All rights reserved.
3#
4# Licensed under your choice of (a) the Redis Source Available License 2.0
5# (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the
6# GNU Affero General Public License v3 (AGPLv3).
7
8source ../tests/support/redis.tcl
9set ::port 12123
10set ::tests {PING,SET,GET,INCR,LPUSH,LPOP,SADD,SPOP,LRANGE_100,LRANGE_600,MSET}
11set ::datasize 16
12set ::requests 100000
13
14proc run-tests branches {
15 set runs {}
16 set branch_id 0
17 foreach b $branches {
18 cd ../src
19 puts "Benchmarking $b"
20 exec -ignorestderr git checkout $b 2> /dev/null
21 exec -ignorestderr make clean 2> /dev/null
22 puts " compiling..."
23 exec -ignorestderr make 2> /dev/null
24
25 if {$branch_id == 0} {
26 puts " copy redis-benchmark from unstable to /tmp..."
27 exec -ignorestderr cp ./redis-benchmark /tmp
28 incr branch_id
29 continue
30 }
31
32 # Start the Redis server
33 puts " starting the server... [exec ./redis-server -v]"
34 set pids [exec echo "port $::port\nloglevel warning\n" | ./redis-server - > /dev/null 2> /dev/null &]
35 puts " pids: $pids"
36 after 1000
37 puts " running the benchmark"
38
39 set r [redis 127.0.0.1 $::port]
40 set i [$r info]
41 puts " redis INFO shows version: [lindex [split $i] 0]"
42 $r close
43
44 set output [exec /tmp/redis-benchmark -n $::requests -t $::tests -d $::datasize --csv -p $::port]
45 lappend runs $b $output
46 puts " killing server..."
47 catch {exec kill -9 [lindex $pids 0]}
48 catch {exec kill -9 [lindex $pids 1]}
49 incr branch_id
50 }
51 return $runs
52}
53
54proc get-result-with-name {output name} {
55 foreach line [split $output "\n"] {
56 lassign [split $line ","] key value
57 set key [string tolower [string range $key 1 end-1]]
58 set value [string range $value 1 end-1]
59 if {$key eq [string tolower $name]} {
60 return $value
61 }
62 }
63 return "n/a"
64}
65
66proc get-test-names output {
67 set names {}
68 foreach line [split $output "\n"] {
69 lassign [split $line ","] key value
70 set key [string tolower [string range $key 1 end-1]]
71 lappend names $key
72 }
73 return $names
74}
75
76proc combine-results {results} {
77 set tests [get-test-names [lindex $results 1]]
78 foreach test $tests {
79 puts $test
80 foreach {branch output} $results {
81 puts [format "%-20s %s" \
82 $branch [get-result-with-name $output $test]]
83 }
84 puts {}
85 }
86}
87
88proc main {} {
89 # Note: the first branch is only used in order to get the redis-benchmark
90 # executable. Tests are performed starting from the second branch.
91 set branches {
92 slowset 2.2.0 2.4.0 unstable slowset
93 }
94 set results [run-tests $branches]
95 puts "\n"
96 puts "# Test results: datasize=$::datasize requests=$::requests"
97 puts [combine-results $results]
98}
99
100# Force the user to run the script from the 'utils' directory.
101if {![file exists speed-regression.tcl]} {
102 puts "Please make sure to run speed-regression.tcl while inside /utils."
103 puts "Example: cd utils; ./speed-regression.tcl"
104 exit 1
105}
106
107# Make sure there is not already a server running on port 12123
108set is_not_running [catch {set r [redis 127.0.0.1 $::port]}]
109if {!$is_not_running} {
110 puts "Sorry, you have a running server on port $::port"
111 exit 1
112}
113
114# parse arguments
115for {set j 0} {$j < [llength $argv]} {incr j} {
116 set opt [lindex $argv $j]
117 set arg [lindex $argv [expr $j+1]]
118 if {$opt eq {--tests}} {
119 set ::tests $arg
120 incr j
121 } elseif {$opt eq {--datasize}} {
122 set ::datasize $arg
123 incr j
124 } elseif {$opt eq {--requests}} {
125 set ::requests $arg
126 incr j
127 } else {
128 puts "Wrong argument: $opt"
129 exit 1
130 }
131}
132
133main