Skip to content

Commit

Permalink
TWEAK: use rpoplpush in lua script
Browse files Browse the repository at this point in the history
Because it's more clear and slightly faster. Increased jobs/sec by about 600.
  • Loading branch information
cypriss committed Jul 10, 2016
1 parent 2a9acb6 commit 25bd71a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ The benches folder contains various benchmark code. In each case, we enqueue 100

| Library | Speed |
| --- | --- |
| [gocraft/work](https://www.github.com/gocraft/work) | **20351 jobs/s** |
| [gocraft/work](https://www.github.com/gocraft/work) | **20944 jobs/s** |
| [jrallison/go-workers](https://www.github.com/jrallison/go-workers) | 19945 jobs/s |
| [benmanns/goworker](https://www.github.com/benmanns/goworker) | 10328.5 jobs/s |
| [albrow/jobs](https://www.github.com/albrow/jobs) | 40 jobs/s |
Expand Down
3 changes: 1 addition & 2 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ var redisLuaRpoplpushMultiCmd = `
local res
local keylen = #KEYS
for i=1,keylen,2 do
res = redis.call('rpop', KEYS[i])
res = redis.call('rpoplpush', KEYS[i], KEYS[i+1])
if res then
redis.call('lpush', KEYS[i+1], res)
return {res, KEYS[i], KEYS[i+1]}
end
end
Expand Down
4 changes: 2 additions & 2 deletions todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ go run main.go

TODO
----
- awesomego PR
- readme:
- webui
- references
- Benchmark latest version of goworker and go-workers again and that other one
- once I have thruput benches in place:
- rpoplpush in lua script
- zero context each time
- do a benchmark to measure memory allocations

- benchmarks for runJob
- investigate changing runJob to use a shared context, and zero'ing it's value each time
Expand Down

0 comments on commit 25bd71a

Please sign in to comment.