Skip to content

feat: Optimize gc cycles and introduce flag for reduced memory usage#95

Merged
dmtrKovalenko merged 4 commits intomainfrom
feat/optimize-gc
Apr 29, 2024
Merged

feat: Optimize gc cycles and introduce flag for reduced memory usage#95
dmtrKovalenko merged 4 commits intomainfrom
feat/optimize-gc

Conversation

@dmtrKovalenko
Copy link
Owner

No description provided.

@dmtrKovalenko dmtrKovalenko merged commit c795417 into main Apr 29, 2024
@dmtrKovalenko dmtrKovalenko deleted the feat/optimize-gc branch April 29, 2024 15:24
let countDifference x y =
diffPixelQueue |> Queue.push (x, y);
incr diffCount;
IO1.setImgColor ~x ~y diffPixel diffOutput;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@dmtrKovalenko
Setting the diff color directly can break the antialiasing detection in some cases.

When diffMask is off, we are changing the pixel color on the base image directly, which we might use later to determine antialiased pixels.
(Remember, that we look at the surrounding 8 pixels to detect antialiasing). So we do look at "past" pixels, which with this change might not be the original color anymore.

Copy link
Owner Author

Choose a reason for hiding this comment

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

But the output image is a totally new buffer copied from the original image and not the same source.

This queue is having a lot of memory overhead for every run

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think on line 30 its the same buffer we use for comparison. We only create a new buffer, when "outputDiffMask" is true.
I might be wrong though. Its been a long time since i looked at this code 😄

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks need to check this again

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.

2 participants