Compare commits

...

1 Commits

Author SHA1 Message Date
Blake Mizerany
95af97b9f3 server: try github.com/minio/sha256-simd
This is an experimental change to see if sha256-simd is faster than the
standard library's sha256 implementation.  It is not yet clear if this
will be a net win, but it is worth trying.
2024-05-31 00:51:20 -07:00
9 changed files with 17 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import (
"context"
"crypto/ed25519"
"crypto/rand"
"crypto/sha256"
"encoding/pem"
"errors"
"fmt"
@ -24,6 +23,8 @@ import (
"syscall"
"time"
"github.com/minio/sha256-simd"
"github.com/containerd/console"
"github.com/mattn/go-runewidth"
"github.com/olekukonko/tablewriter"

View File

@ -2,13 +2,14 @@ package convert
import (
"cmp"
"crypto/sha256"
"encoding/json"
"fmt"
"log/slog"
"os"
"slices"
"github.com/minio/sha256-simd"
"golang.org/x/exp/maps"
)

1
go.mod
View File

@ -33,6 +33,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/kr/text v0.2.0 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect

2
go.sum
View File

@ -135,6 +135,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=

@ -1 +1 @@
Subproject commit 5921b8f089d3b7bda86aac5a66825df6a6c10603
Subproject commit 74f33adf5f8b20b08fc5a6aa17ce081abe86ef2f

View File

@ -3,7 +3,6 @@ package server
import (
"context"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"encoding/json"
@ -15,6 +14,8 @@ import (
"strings"
"time"
"github.com/minio/sha256-simd"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/auth"
)

View File

@ -4,7 +4,6 @@ import (
"bytes"
"cmp"
"context"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"encoding/json"
@ -21,14 +20,16 @@ import (
"strconv"
"strings"
"github.com/minio/sha256-simd"
"golang.org/x/exp/slices"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/auth"
"github.com/ollama/ollama/envconfig"
"github.com/ollama/ollama/format"
"github.com/ollama/ollama/llm"
"github.com/ollama/ollama/parser"
"github.com/ollama/ollama/envconfig"
"github.com/ollama/ollama/types/errtypes"
"github.com/ollama/ollama/types/model"
"github.com/ollama/ollama/version"

View File

@ -1,10 +1,11 @@
package server
import (
"crypto/sha256"
"fmt"
"io"
"os"
"github.com/minio/sha256-simd"
)
type Layer struct {

View File

@ -2,7 +2,6 @@ package server
import (
"bytes"
"crypto/sha256"
"encoding/json"
"fmt"
"io"
@ -10,6 +9,8 @@ import (
"os"
"path/filepath"
"github.com/minio/sha256-simd"
"github.com/ollama/ollama/types/model"
)