Skip to content

refactoring: adjust Image cache mechanism#422

Merged
Songmu merged 1 commit intomainfrom
image-cache
Sep 1, 2025
Merged

refactoring: adjust Image cache mechanism#422
Songmu merged 1 commit intomainfrom
image-cache

Conversation

@Songmu
Copy link
Collaborator

@Songmu Songmu commented Sep 1, 2025

Since Image now has mutable states and fields beyond image data, using it directly as a cache could cause unexpected side effects; therefore, we now cache internalImage instead of the Image itself.

This means we can no longer share caches when different keys have the same data, resulting in a slight reduction in efficiency. However, if necessary, we can continue to optimize this part later.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Since Image now has mutable states and fields beyond image data, using it directly as a cache could cause unexpected side effects; therefore, we now cache `internalImage` instead of the `Image` itself.

This means we can no longer share caches when different keys have the same data, resulting in a slight reduction in efficiency. However, if necessary, we can continue to optimize this part later.
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

Code Metrics Report

main (4e881b2) #422 (af44159) +/-
Coverage 32.3% 32.7% +0.3%
Code to Test Ratio 1:0.8 1:0.8 +0.0
Test Execution Time 11s 10s -1s
Details
  |                     | main (4e881b2) | #422 (af44159) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          32.3% |          32.7% | +0.3% |
  |   Files             |             28 |             28 |     0 |
  |   Lines             |           3120 |           3099 |   -21 |
+ |   Covered           |           1010 |           1014 |    +4 |
+ | Code to Test Ratio  |          1:0.8 |          1:0.8 |  +0.0 |
  |   Code              |           6432 |           6403 |   -29 |
+ |   Test              |           5630 |           5695 |   +65 |
+ | Test Execution Time |            11s |            10s |   -1s |

Code coverage of files in pull request scope (36.8% → 37.7%)

Files Coverage +/- Status
apply.go 1.4% +0.0% modified
cache.go 100.0% +30.0% modified
convert.go 0.0% 0.0% modified
image.go 67.3% +6.6% modified
md/md.go 78.6% +0.0% modified
preload.go 0.0% 0.0% modified

Reported by octocov

@Songmu Songmu merged commit 477f0cd into main Sep 1, 2025
1 check passed
@Songmu Songmu deleted the image-cache branch September 1, 2025 09:32
@github-actions github-actions bot mentioned this pull request Sep 1, 2025
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.

1 participant