I'm trying to parse a huge json to find some identifiers in it in the fastest and most memory efficient manner. I'm currently doing:
reader := bufio.NewReader(f)
// Read file byte by byte
for {
b, err := reader.ReadByte()
if err != nil {
if err.Error() == "EOF" {
break
}
return nil, err
}
// Do something simple with b that is definitely not a bottleneck,
// since I get same times even when commenting everything in here out.
}
But it's taking 10 seconds for a 250MB json file, which seems way too slow. I'm assuming I'm doing something wrong right? There has to be a faster way.