Skip to content

Template compilation caching to improve performance#73

Open
Nabihamasroor wants to merge 2 commits intoaccordproject:mainfrom
Nabihamasroor:TemplateArchiveProcessor
Open

Template compilation caching to improve performance#73
Nabihamasroor wants to merge 2 commits intoaccordproject:mainfrom
Nabihamasroor:TemplateArchiveProcessor

Conversation

@Nabihamasroor
Copy link

Fixes #42

Changes

  • Added TemplateValidator class for validating templates before processing
  • Implemented caching system using Map to store compiled code and avoid recompilation
  • Modified init() and trigger() methods to accept optional compiledTemplate parameter
  • Added cache key generation based on template content hash
    -Implemented cache management with invalidateCache() and clearAllCaches() methods
  • Updated tests to validate caching behavior and performance improvements

Features

  • Separate Compile Step: Compile TypeScript once instead of on every trigger/init call
  • Performance Monitoring: Cache hit/miss statistics for optimization tracking

Signed-off-by: nabiha <nmasroor@forthlogic.com>
…rocessor

Signed-off-by: nabiha <nmasroor@forthlogic.com>
Copy link
Contributor

@dselman dselman left a comment

Choose a reason for hiding this comment

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

I like this but:

  1. Is the validator a separate concern to the compilation output caching? It looks like it should be its own PR?
  2. I want to reimplement the compiler using the code I have in a draft PR removing the two slash dependency. Let me complete that work first then you can add caching on top.

@Nabihamasroor
Copy link
Author

@dselman Thanks for the feedback! I'll wait for your refactor to be completed first. Let me know when I should rebase this 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.

precompiled trigger support

2 participants