Skip to content
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

Optimization PINMemoryCache trim to date #252

Merged
merged 7 commits into from
Mar 2, 2020

Conversation

kinarobin
Copy link
Contributor

I notice PINMemoryCache had some usage for trim to age limit recursively.

Every time ordering the createdDates for trim to age is so expensive, and we don't use the sort of container any more for other scene.

So, instead of sort the container, we could delete the expired objects with a for loop directly.

Time Complexity: (√n * n + (expired count) ) -> n

@kinarobin
Copy link
Contributor Author

I run all tests locally. No errors occurred!

2019-06-27-1 01 37

@garrettmoon
Copy link
Collaborator

Yes! It's not your fault, it's the build machine, I'll either fix or merge, thank you for the PR!

@kinarobin
Copy link
Contributor Author

@garrettmoon. Could you take a look ? Thanks!

@ghost
Copy link

ghost commented Dec 12, 2019

🚫 CI failed with log

Copy link
Collaborator

@jparise jparise left a comment

Choose a reason for hiding this comment

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

This looks good, and CI is now fixed and passing. Thanks for the improvement, @kinarobin!

@jparise jparise merged commit 91fd8d0 into pinterest:master Mar 2, 2020
@kinarobin kinarobin deleted the optimize_memory_trim_to_date branch July 9, 2020 10:43
adlerj pushed a commit to adlerj/PINCache that referenced this pull request Aug 4, 2020
* commit 'df60b0d9c1903ca4cdb1e928b04ea1203aa28ad2':
  Support Catalyst (pinterest#272)
  Fix the grammar in an assertion failure message (pinterest#270)
  Remove the unused CI directory (pinterest#265)
  Fix up analyze for github CI (pinterest#264)
  Check fileURL outside of the locked scope (pinterest#262)
  Optimization `PINMemoryCache` trim to date (pinterest#252)
  Use correct class name in NSAssert() messages (pinterest#263)
  Remove Danger from the project (pinterest#261)
  Link to master branch workflow from the CI badge
  Test that the "remove object" blocks are called (pinterest#258)
  Fix GitHub Actions CI badge
  Switch to GitHub Actions for CI (pinterest#259)
  Discrepancy between Header Comment and Implementation (pinterest#257)

# Conflicts:
#	Makefile
#	PINCache.xcodeproj/project.pbxproj
#	Tests/PINCacheTests.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants