all: use bufio.Reader to improve reading speed

This commit is contained in:
Hajime Hoshi 2024-07-29 02:28:37 +09:00
parent 563f2e0e0b
commit ef5ac4175d
2 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,7 @@
package main
import (
"bufio"
"bytes"
_ "embed"
"fmt"
@ -81,7 +82,7 @@ func main() {
fmt.Println("Play the default video. You can specify a video file as an argument.")
}
player, err := newMPEGPlayer(in)
player, err := newMPEGPlayer(bufio.NewReader(in))
if err != nil {
log.Fatal(err)
}

View File

@ -15,6 +15,7 @@
package mtl_test
import (
"bufio"
"fmt"
"image"
"image/color"
@ -147,7 +148,7 @@ func readPNG(name string) (image.Image, error) {
defer func() {
_ = f.Close()
}()
return png.Decode(f)
return png.Decode(bufio.NewReader(f))
}
// imageEq reports whether images m, n are considered equivalent. Two images are considered