Skip to content

postgres: some perf work - #1984

Merged
github-actions[bot] merged 4 commits into
quay:mainfrom
hdonnay:hack/perf/dbhash
Aug 17, 2026
Merged

postgres: some perf work#1984
github-actions[bot] merged 4 commits into
quay:mainfrom
hdonnay:hack/perf/dbhash

Conversation

@hdonnay

@hdonnay hdonnay commented Aug 13, 2026

Copy link
Copy Markdown
Member

This is a stab at some memory optimizations that jumped out. This now uses less than half the memory for calculating a hash:

% go test -run none -bench Hash\|MD5        
goos: linux
goarch: amd64
pkg: github.com/quay/claircore/datastore/postgres
cpu: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
BenchmarkMD5Vuln/Baseline-16     	  886275	      1622 ns/op	     648 B/op	      10 allocs/op
BenchmarkMD5Vuln/Current-16      	 1000000	      1195 ns/op	     232 B/op	       7 allocs/op
BenchmarkVulnerabilityHash/MD5-16         	 1000000	      1259 ns/op	     232 B/op	       7 allocs/op
BenchmarkVulnerabilityHash/XXH64-16       	 1379953	       863.0 ns/op	     224 B/op	       7 allocs/op
PASS
ok  	github.com/quay/claircore/datastore/postgres	5.093s

@hdonnay
hdonnay requested review from a team as code owners August 13, 2026 19:16
@hdonnay
hdonnay requested a review from crozzy August 13, 2026 19:16
@hdonnay
hdonnay force-pushed the hack/perf/dbhash branch 4 times, most recently from a8475ff to cd11a73 Compare August 17, 2026 16:16
@hdonnay hdonnay added this to the Performance milestone Aug 17, 2026
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Change-Id: I01347223e05f3418fb5c4991e145dba76a6a6964
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Change-Id: I833afdeae0cfa4763fbb83e03c7aff676a6a6964
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Change-Id: I5887c9b94cf2f03db35a2a1374d4d45b6a6a6964
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Change-Id: I3f9b6a1675678dca3e669dced0007a8a6a6a6964

@crozzy crozzy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@hdonnay

hdonnay commented Aug 17, 2026

Copy link
Copy Markdown
Member Author

/fast-forward

@github-actions
github-actions Bot merged commit 6b23c3f into quay:main Aug 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants