-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: improve the read performance to 1166960 ops/sec with compound i…
…ndex - Replace usage of sort and time packages with `github.com/wangjia184/sortedset` for improved ad sorting and querying in `store.go`. - Introduce new indexing structure for ads, shifting from a simple interval-based approach to a more detailed, hierarchical indexing model involving age, country, platform, and gender, to facilitate more efficient ad queries. - Implement the `AdIndex` interface with methods for adding, removing, and querying ads based on specific criteria to support dynamic ad management. - Modify age fields in `Ad` struct from `int` to `uint8` to reflect the age range more accurately and efficiently in `store.go` and `ad.go`. - Update test cases in `store_test.go` to accommodate the change in age field type and refine the test scenarios for ad retrieval, including performance and accuracy tests. - Reduce the batch size for performance testing from a range of 20,000-50,000 to a fixed range of 1,000-2,000 to ensure the tests are more manageable and reflective of realistic scenarios. - Lower the performance expectation threshold in the create performance test from 10,000 ops/sec to 10 ops/sec, aligning with the new, more complex indexing strategy's processing capabilities. - Add a boolean `IsActive` field to the `Ad` struct to support toggling ad visibility without deletion, enhancing ad management flexibility.
- Loading branch information
Showing
4 changed files
with
148 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.