summaryrefslogtreecommitdiff
path: root/test/bench/fasta.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/bench/fasta.go')
-rw-r--r--test/bench/fasta.go47
1 files changed, 22 insertions, 25 deletions
diff --git a/test/bench/fasta.go b/test/bench/fasta.go
index 470bdb328..d13edd5dc 100644
--- a/test/bench/fasta.go
+++ b/test/bench/fasta.go
@@ -37,7 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
package main
import (
- "bytes"
"flag"
"os"
)
@@ -49,7 +48,7 @@ var n = flag.Int("n", 1000, "length of result")
const Line = 60
func Repeat(alu []byte, n int) {
- buf := bytes.Add(alu, alu)
+ buf := append(alu, alu...)
off := 0
for n > 0 {
m := n
@@ -138,28 +137,28 @@ func main() {
flag.Parse()
iub := []Acid{
- Acid{prob: 0.27, sym: 'a'},
- Acid{prob: 0.12, sym: 'c'},
- Acid{prob: 0.12, sym: 'g'},
- Acid{prob: 0.27, sym: 't'},
- Acid{prob: 0.02, sym: 'B'},
- Acid{prob: 0.02, sym: 'D'},
- Acid{prob: 0.02, sym: 'H'},
- Acid{prob: 0.02, sym: 'K'},
- Acid{prob: 0.02, sym: 'M'},
- Acid{prob: 0.02, sym: 'N'},
- Acid{prob: 0.02, sym: 'R'},
- Acid{prob: 0.02, sym: 'S'},
- Acid{prob: 0.02, sym: 'V'},
- Acid{prob: 0.02, sym: 'W'},
- Acid{prob: 0.02, sym: 'Y'},
+ {prob: 0.27, sym: 'a'},
+ {prob: 0.12, sym: 'c'},
+ {prob: 0.12, sym: 'g'},
+ {prob: 0.27, sym: 't'},
+ {prob: 0.02, sym: 'B'},
+ {prob: 0.02, sym: 'D'},
+ {prob: 0.02, sym: 'H'},
+ {prob: 0.02, sym: 'K'},
+ {prob: 0.02, sym: 'M'},
+ {prob: 0.02, sym: 'N'},
+ {prob: 0.02, sym: 'R'},
+ {prob: 0.02, sym: 'S'},
+ {prob: 0.02, sym: 'V'},
+ {prob: 0.02, sym: 'W'},
+ {prob: 0.02, sym: 'Y'},
}
homosapiens := []Acid{
- Acid{prob: 0.3029549426680, sym: 'a'},
- Acid{prob: 0.1979883004921, sym: 'c'},
- Acid{prob: 0.1975473066391, sym: 'g'},
- Acid{prob: 0.3015094502008, sym: 't'},
+ {prob: 0.3029549426680, sym: 'a'},
+ {prob: 0.1979883004921, sym: 'c'},
+ {prob: 0.1975473066391, sym: 'g'},
+ {prob: 0.3015094502008, sym: 't'},
}
alu := []byte(
@@ -192,9 +191,7 @@ func (b *buffer) Flush() {
func (b *buffer) WriteString(s string) {
p := b.NextWrite(len(s))
- for i := 0; i < len(s); i++ {
- p[i] = s[i]
- }
+ copy(p, s)
}
func (b *buffer) NextWrite(n int) []byte {
@@ -204,6 +201,6 @@ func (b *buffer) NextWrite(n int) []byte {
p = *b
}
out := p[len(p) : len(p)+n]
- *b = p[0 : len(p)+n]
+ *b = p[:len(p)+n]
return out
}