Golang string concatenation efficiency

Source: Internet
Author: User
Tags benchmark
This is a creation in Article, where the information may have evolved or changed.

Bash:go test-bench=. -test.benchmemgoos:darwingoarch:amd64pkg:benchmarkBenchmarkConcatString-4        10000000           169Ns/op530B/op0allocs/Opbenchmarkconcatbuffer-4        100000000            11.7Ns/op2B/op0allocs/Opbenchmarkconcatbuilder-4       100000000            13.1Ns/op2B/op0allocs/Oppassok Benchmark4.416s

Help

-Test.bench RegExp Run only benchmarks matching regexp-test.benchmem Print Memory Allocations forBenchmarks-Test.benchtime D run each benchmark forduration d (default 1s)-test.blockprofilefile        WriteA goroutine blocking profile tofile-test.blockprofilerate rate Set blocking profiles rate (see runtime. setblockprofilerate) (Default1)  -test.count N Run tests and benchmarks N times (default1)  -test.coverprofilefile        WriteA coverage profile tofile-test.cpu list Comma-separated list of CPUs counts to run all test with-test.cpuprofilefile        WriteA CPU profile tofile-Test.failfast DoNot start new tests after the first test failure-test.list regexp list tests, examples, and benchmarks matching regexp ThenExit-test.memprofilefile        WriteA memory profile tofile-test.memprofilerate rate Set memory profiling rate (see runtime. Memprofilerate)-test.mutexprofilestring        WriteA mutex contention profile to the namedfileAfter execution-test.mutexprofilefractionint        if>=0, calls runtime. Setmutexprofilefraction () (Default1)  -test.outputdirdir        WriteProfiles todir-test.parallel N Run at the most n testsinchParallel (default4)  -Test.run RegExp Run only tests and examples matching regexp-test. Shortrun smaller test suite to save Time-test.testlogfilefile        WriteTest action Log tofile( forUse only by cmd/go)-test.timeout D Panic Test binary after duration d (default0, timeout disabled)-test.tracefile        WriteAn execution trace tofile-test.v verbose:print Additional output

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.