Skip to content

perf(blooms): Replace JSON lib for encoding/decoding metas #14767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Replace JSON lib for encoding/decoding metas
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
  • Loading branch information
chaudum committed Nov 5, 2024
commit c5c8e9d98f9766118453724d98c7d02a647b022c
6 changes: 5 additions & 1 deletion pkg/storage/stores/shipper/bloomshipper/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package bloomshipper

import (
"context"
"encoding/json"
"os"
"path/filepath"
"sync"
Expand All @@ -11,6 +10,7 @@ import (
"github.com/dolthub/swiss"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"k8s.io/utils/keymutex"
Expand Down Expand Up @@ -189,6 +189,8 @@ func (f *Fetcher) processMetasCacheResponse(_ context.Context, refs []MetaRef, k

var lastErr error
var size int64

json := jsoniter.ConfigFastest
for i, ref := range refs {
if raw, ok := found[f.client.Meta(ref).Addr()]; ok {
meta := Meta{
Expand All @@ -209,6 +211,8 @@ func (f *Fetcher) writeBackMetas(ctx context.Context, metas []Meta) error {
var err error
keys := make([]string, len(metas))
data := make([][]byte, len(metas))

json := jsoniter.ConfigFastest
for i := range metas {
keys[i] = f.client.Meta(metas[i].MetaRef).Addr()
data[i], err = json.Marshal(metas[i])
Expand Down