Skip to content

Commit

Permalink
Revert "Try replacing jpeg library to reduce allocs"
Browse files Browse the repository at this point in the history
This reverts commit d3eb5a9.
  • Loading branch information
turt2live committed Aug 26, 2023
1 parent d5160a6 commit 505e74d
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 55 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
go-version: '1.20'
- name: "Install libheif"
run: "chmod +x ./.github/workflows/build-libheif.sh && ./.github/workflows/build-libheif.sh"
- name: "Install libjpeg-turbo"
run: "sudo apt-get install libjpeg-turbo-dev"
- run: './build.sh' # verify the thing compiles
static:
name: 'Go Static (1.20)'
Expand All @@ -25,8 +23,6 @@ jobs:
go-version: '1.20'
- name: "Install libheif"
run: "chmod +x ./.github/workflows/build-libheif.sh && ./.github/workflows/build-libheif.sh"
- name: "Install libjpeg-turbo"
run: "sudo apt-get install libjpeg-turbo-dev"
- name: "Prepare: compile assets"
run: "GOBIN=$PWD/bin go install -v ./cmd/compile_assets"
- name: "Run: compile assets"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FROM golang:1.20-alpine AS builder

# Install build dependencies
RUN apk add --no-cache git musl-dev dos2unix build-base libde265-dev libheif-dev libjpeg-turbo-dev
RUN apk add --no-cache git musl-dev dos2unix build-base libde265-dev libheif-dev

WORKDIR /opt
COPY . /opt
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ require (
github.com/t2bot/go-typed-singleflight v0.0.3
github.com/testcontainers/testcontainers-go v0.23.0
github.com/testcontainers/testcontainers-go/modules/postgres v0.23.0
github.com/viam-labs/go-libjpeg v0.3.2-0.20230621193101-e6b235025092
golang.org/x/sync v0.3.0
golang.org/x/term v0.11.0
)
Expand Down Expand Up @@ -116,6 +115,7 @@ require (
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/smartystreets/assertions v1.0.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.11.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ github.com/sebest/xff v0.0.0-20210106013422-671bd2870b3a/go.mod h1:wozgYq9WEBQBa
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8=
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -370,12 +371,9 @@ github.com/testcontainers/testcontainers-go v0.23.0 h1:ERYTSikX01QczBLPZpqsETTBO
github.com/testcontainers/testcontainers-go v0.23.0/go.mod h1:3gzuZfb7T9qfcH2pHpV4RLlWrPjeWNQah6XlYQ32c4I=
github.com/testcontainers/testcontainers-go/modules/postgres v0.23.0 h1:OEGUC1YTN1RyS4xqsHmlyYkBWm9lMJcswoV4JSHJQOM=
github.com/testcontainers/testcontainers-go/modules/postgres v0.23.0/go.mod h1:YnqIhPwhjqVbJBuvSRJS6pa9Cy1PDRJcrM6T63Uw2ms=
github.com/viam-labs/go-libjpeg v0.3.2-0.20230621193101-e6b235025092 h1:DsILjTWWpYH9jl+AsxqkSdbocxkrHxCwCBgHnYTsnfs=
github.com/viam-labs/go-libjpeg v0.3.2-0.20230621193101-e6b235025092/go.mod h1:BCaeb3/txASzLy3XwzuzqFMs+u0cEf+wdiQQL3TxQVo=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.viam.com/test v1.1.0 h1:KXf8crEwt0bHn5iMsjmXg0vPio/yzKGrfd20sWhe/t4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down
39 changes: 0 additions & 39 deletions jpeg2/jpeg_picker.go

This file was deleted.

3 changes: 1 addition & 2 deletions thumbnailing/i/jpg.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package i
import (
"errors"
"image"
_ "image/jpeg"
"io"

_ "github.com/turt2live/matrix-media-repo/jpeg2"

"github.com/disintegration/imaging"
"github.com/turt2live/matrix-media-repo/common/rcontext"
"github.com/turt2live/matrix-media-repo/thumbnailing/m"
Expand Down
4 changes: 0 additions & 4 deletions util/readers/buffer_reads_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,3 @@ func (r *BufferReadsReader) GetRewoundReader() io.Reader {
pr, _ := r.MakeRewoundReader()
return pr
}

func (r *BufferReadsReader) Discard() {
r.b.Truncate(0)
}

0 comments on commit 505e74d

Please sign in to comment.