dgen
A command-line tool designed for repeating a string an excessive number of
times.

Installation
go get github.com/steven-xie/dgen
Usage
To repeat "test string" 50 times, simply perform the following command:
dgen "test string " 50
# Output: test string test string (...)
For more advanced usage options, view the help prompt with:
dgen --help
Presets
dgen
comes with several presets in order to make your life easier. Each preset
represents the character limit on the associated messaging service:
dgen "π " fb
# Output: π π π π π π π π π (... x5000)
List of current dgen
presets:
Name / ID |
Value |
service |
fb |
5000 |
Facebook Messenger |
twitter |
280 |
Twitter |
rpost |
40,000 |
Reddit (post) |
rcomment |
10,000 |
Reddit (comment) |
rmsg |
10,000 |
Reddit (message) |
dgen
is one of the top-of-the-line string generators out there. dgen v1.0.1
sports the following benchmark:
- Input: "benchmark test text "
- Repetitions: 1,000,000
- Duration: 25.050 seconds
- Milliseconds / operation: 0.025039
- Bytes allocated / operation: 21
- Allocations / operation: 0
Integration
dgen
is a thin wrapper around an internal library, throughput
, which
contains the actual repeating and buffering logic. To create a program with
dgen
's string dumping capabilities, simply import throughput
:
import (
"github.com/steven-xie/dgen/throughput"
"os"
)
func main() {
const (
repstr = "test string "
reps = 5000
bufsize = throughput.RecommendedBufSize
)
// Dump "test string " 5000 times into os.Stdout.
throughput.Dump(repstr, reps, bufsize, os.Stdout)
}