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

feat: OPTIC-1479: Improve memory usage of Image tag #6930

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

bmartel
Copy link
Contributor

@bmartel bmartel commented Jan 17, 2025

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Backend (Database)
  • Backend (API)
  • Frontend

Describe the reason for change

Through other investigations it was surfaced that there was an unnecessary handling of image data in memory, which included caching raw data in a Map. Storing information in a Map is dangerous for unintended memory growth to occur as Map's do not get garbage collected very easily, most times not. Further to this, there is no clear use case to not just using the browser as normal to load image data from the provided urls directly, allowing the browser heuristics to effeciently manage the memory and caching of these image requests.

Does this change affect performance?

Separately fetching data of the image to cache and produce a base64 DataURL is not more efficient than using the browser's baseline primitives directly. This in small sample sizes would be no difference, but larger sample sizes with greater number and filesize of images would lead to improved memory usage and performance within the application.

What feature flags were used to cover this change?

  • fflag_feat_front_optic_1479_improve_image_tag_memory_usage_short

Does this PR introduce a breaking change?

(check only one)

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

Which logical domain(s) does this change affect?

ImageEntity (ImageMixin -> Image tag)

@github-actions github-actions bot added the feat label Jan 17, 2025
Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 5bb168d
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/678ad6faf9e6a00008bdace5

Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 5bb168d
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/678ad6fadc3fea0008d11016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant