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

MVP serialize #7

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

MVP serialize #7

wants to merge 3 commits into from

Conversation

astrale-sharp
Copy link

@astrale-sharp astrale-sharp commented Apr 9, 2024

Howdy,
this is a very minimal implementation of which the design must be discussed:

# How it works:
It registers serialization and de-serialization functions at declaration time and provides the serialization implementation.

You can retrieve a blob of data using comemo::serialize() and replace your current caches using comemo::deserialize

It needs a unique ID per function, currently it's a String using the module_path, file name and line but small performance could be gained by hashing it. (It's not using the name because syn current parsing provide a function item which is nameless)

What I like:

  • It works
  • It's not super complex

What I like less:

  • hard codes the serialization implementation (bincode), not necessarily a big deal but we should at least ensure it's the most efficient one
  • exposes CacheData via inner() method which is a possible foot-gun for users (it's doc(hidden) so I feel like it's their responsibility)
  • To enable it per function, you need to add the serialize attribute, I think we should assume serialization and provide instead a no serialize option
  • No way to measure how much data is useful, silently ignores incorrect data

@astrale-sharp astrale-sharp marked this pull request as draft April 9, 2024 15:53
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.

None yet

1 participant