speed optimizations

This commit is contained in:
2026-02-12 13:01:52 -08:00
parent 2d46dc70a9
commit cf79e008b5
8 changed files with 301 additions and 79 deletions
+5 -1
View File
@@ -7,6 +7,8 @@ import (
"os"
)
const copyBufferSize = 4 * 1024 * 1024 // 4MB buffer for large file copies
func CopyFile(src, dst string) (err error) {
slog.Info("copying file", "src", src, "dst", dst)
@@ -31,7 +33,9 @@ func CopyFile(src, dst string) (err error) {
}
}()
written, err := io.Copy(dstFile, srcFile)
// Use a larger buffer for better performance with large database files
buf := make([]byte, copyBufferSize)
written, err := io.CopyBuffer(dstFile, srcFile, buf)
if err != nil {
return fmt.Errorf("copying data: %w", err)
}