switched from splitting the string block to splitting bytes and converting lines

This commit is contained in:
David Högborg
2015-07-17 23:47:39 +02:00
parent a4ce307d34
commit 0c18fc145d

View File

@@ -1,6 +1,7 @@
package gopow package gopow
import ( import (
"bytes"
"image" "image"
"image/color" "image/color"
"io/ioutil" "io/ioutil"
@@ -72,14 +73,13 @@ func (t *TableComplex) parseBuffer(filebuffer []byte) []*LineComplex {
t.Max = float64(math.MaxFloat64 * -1) t.Max = float64(math.MaxFloat64 * -1)
t.Min = float64(math.MaxFloat64) t.Min = float64(math.MaxFloat64)
block := string(filebuffer) lines := bytes.Split(filebuffer, []byte("\n"))
lines := strings.Split(block, "\n")
table := map[string][]*LineComplex{} table := map[string][]*LineComplex{}
for _, l := range lines { for _, l := range lines {
cells := strings.Split(l, ",") cells := strings.Split(string(l), ",")
line := NewLineComplex(cells) line := NewLineComplex(cells)
if table[line.Hash] == nil { if table[line.Hash] == nil {
@@ -176,7 +176,6 @@ func (t *TableComplex) IntegrateLines(lines []*LineComplex) *LineComplex {
if i > 0 { if i > 0 {
masterline.AddSamples(l) masterline.AddSamples(l)
} }
} }
return masterline return masterline