mirror of
https://github.com/goodhosts/hostsfile.git
synced 2026-04-27 07:25:53 +03:00
[PR #28] [MERGED] add ip/host lookup hashmap #37
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hostsfile#37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/goodhosts/hostsfile/pull/28
Author: @luthermonson
Created: 12/2/2021
Status: ✅ Merged
Merged: 12/2/2021
Merged by: @luthermonson
Base:
main← Head:add-lookup📝 Commits (2)
946b651add ip/host lookup hashmap to speedup and support multi location within the file4106b03vendor📊 Changes
37 files changed (+3923 additions, -279 deletions)
View changed files
📝
go.mod(+2 -0)📝
go.sum(+12 -0)📝
hosts.go(+130 -70)📝
hosts_test.go(+157 -174)📝
slice.go(+31 -5)📝
slice_test.go(+18 -30)➕
vendor/github.com/corpix/uarand/.gitignore(+2 -0)➕
vendor/github.com/corpix/uarand/.travis.yml(+3 -0)➕
vendor/github.com/corpix/uarand/LICENSE(+24 -0)➕
vendor/github.com/corpix/uarand/Makefile(+32 -0)➕
vendor/github.com/corpix/uarand/README.md(+38 -0)➕
vendor/github.com/corpix/uarand/shell.nix(+17 -0)➕
vendor/github.com/corpix/uarand/uarand.go(+63 -0)➕
vendor/github.com/corpix/uarand/useragents.go(+1735 -0)➕
vendor/github.com/icrowley/fake/.gitignore(+26 -0)➕
vendor/github.com/icrowley/fake/.go-makefile.json(+11 -0)➕
vendor/github.com/icrowley/fake/.travis.yml(+11 -0)➕
vendor/github.com/icrowley/fake/LICENSE(+22 -0)➕
vendor/github.com/icrowley/fake/Makefile(+48 -0)➕
vendor/github.com/icrowley/fake/README.md(+90 -0)...and 17 more files
📄 Description
Problem: after benchmarking it turns out this package doesn't scale once the entries increase per https://github.com/goodhosts/cli/issues/28
Fix: This PR changes from the over reliance of the slice lookup method to a hashmap for the ips and hosts so we can pull position instantly. This fix is thread safe as confirmed by the benchmarks and modifies the API especially with hose hosts need to be pointers now due to the mutex having to be maintained for thread safety.
Extras:
Related Issues:
Should fix https://github.com/goodhosts/cli/issues/25
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.