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

remove parsed address cache #43

Merged
merged 1 commit into from
Sep 16, 2023
Merged

remove parsed address cache #43

merged 1 commit into from
Sep 16, 2023

Conversation

plally
Copy link
Member

@plally plally commented Sep 16, 2023

The performance benefit from this is pretty small and complicating the caching logic to resolve #39 makes that difference even smaller, and in some cases worse.

It would be better to do caching around the CFCHTTP.GetOptionsForURL function

@plally plally merged commit fdcf19a into main Sep 16, 2023
1 check passed
@Grocel
Copy link

Grocel commented Sep 17, 2023

The issue with complex caching logic as seen in #41 comes from removing invalid entries in every add/set call using a relatively expensive invalidation check for each cell. That's why I actually just table.Empty() the cache content on overflow without any other checks for my case shown in #39.

On set/add: It is a O(n) vs. about O(1) with a single cheaper O(n) on overflow which happen rarely in practice.

But because those string operations behind it are indeed not that expensive, removing the cache is fine too, I guess. For my case I use the limited cache in front of a way more expensive (e.g. networking) tasks.

@plally
Copy link
Member Author

plally commented Sep 17, 2023

Would that actually be O(n). It should only have to loop over the expired items since they are ordered by time added in a queue.

@Grocel
Copy link

Grocel commented Sep 17, 2023

I'm not sure if we understand each other at the moment.

@plally
Copy link
Member Author

plally commented Sep 17, 2023

I was talking about the complexity of setting an item on the cache structure I had in the other PR

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.

CFCHTTP.GetAddress() could memory leak by cache.
2 participants