dgen

command module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2018 License: MIT Imports: 1 Imported by: 0

README ΒΆ

dgen

A CLI tool for repeating a string an excessive number of times.

Github Release Go Report Card

Installation

Check out the latest compiled release!

To install from source, make sure you have Go installed, and run:

go get github.com/stevenxie/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)

Performance

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:

package main

import (
  "github.com/stevenxie/dgen/throughput"
  "os"
)


func main() {
  var (
    repstr  = "test string "
    reps    = 5000
    bufsize = throughput.RecommendedBufSize
  )

  // Dump "test string " 5000 times into os.Stdout.
  throughput.Dump(repstr, reps, bufsize, os.Stdout)
}

Documentation ΒΆ

Overview ΒΆ

Dgen is capable of repeating a string a large number of times. To repeat "test string" 5 times, simply perform the following command:

dgen "test string " 5
// Output: "test string test string (...)"

For more advanced usage options, view the help prompt with:

dgen --help

Directories ΒΆ

Path Synopsis
Package throughput provides functionality for producing content at an extremely high rate.
Package throughput provides functionality for producing content at an extremely high rate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL