Shyam-Sundar-Bharathi / cse210-tinyfoot-team14

MIT License
0 stars 0 forks source link

001-ADR-Implement-Footnote-Caching-for-Improved-Performance #1

Closed kenny-lfx closed 23 hours ago

kenny-lfx commented 3 days ago

Implement Footnote Caching for Improved Performance

Context and Problem Statement

BigFoot.js dynamically generates and manages footnotes in real-time whenever a user interacts with a page. While this approach ensures that footnotes are always up-to-date, it can lead to unnecessary recomputation and performance overhead, especially for pages with a large number of footnotes or complex content. To improve performance, we need a way to reduce redundant footnote processing by caching footnote data.

Decision Drivers

Considered Options

Decision Outcome

Chosen option: "Implement local caching of footnote data," because it offers a balanced approach to improving performance without relying heavily on browser storage or disrupting the current dynamic footnote generation. This method can store footnote data in memory for the duration of the page session, reducing the need for repeated calculations.

Consequences

Confirmation

This decision will be confirmed through performance benchmarking before and after the implementation. Testing will focus on pages with varying footnote quantities to ensure caching improves both the perceived and actual performance. Memory profiling will ensure there are no memory leaks or excessive memory usage from the cache.

Pros and Cons of Other Options

Use browser-based caching (localStorage or sessionStorage)

Keep the current implementation without caching

Shyam-Sundar-Bharathi commented 3 days ago

Hi guys, I reviewed your ADR and did some research on cacheing the footnotes myself. Here are my thoughts:

Good

  1. Good focus on performance: The local caching solution does a great job of improving page load times without making things too complicated. It avoids the hassle of persistent storage and still speeds things up.

  2. Works well with the current system: This approach fits smoothly into the existing setup, so we don’t have to make big changes to how footnotes work. It's a smart upgrade without much disruption.

Bad

  1. Adds some complexity: While caching helps with speed, it could make the footnote logic a bit harder to manage. It might be helpful to flag any issues early if debugging becomes tricky. Clear documentation of the caching steps would definitely help later on. More technical detail could help your ADR.
rashi-bhansali commented 3 days ago

I like this idea because it addresses a concern that we noticed while finding the tool pain points. However, like you mentioned, it will be super effective for docs with large no. of footnotes, not very noticeable in the regular usecase. Given the time limit of 2 days, I'm not sure if we can achieve this, Browser based caching seems simpler to implement, not ideal though

rashi-bhansali commented 3 days ago

Lazy loading and Virtual DOM could be another approach for improving performance.

shouhardik commented 3 days ago

The idea of improving footnote caching seems good! Implementing caching, we can have separate client side and server side cachcing in CoffeeScript

Shyam-Sundar-Bharathi commented 23 hours ago

Closing this issue - unable to implement within given time frame / unclear implementation procedure.