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: Optimize gc cycles and introduce flag for reduced memory usage #95

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

dmtrKovalenko
Copy link
Owner

No description provided.

@dmtrKovalenko dmtrKovalenko merged commit c795417 into main Apr 29, 2024
4 of 6 checks passed
@dmtrKovalenko dmtrKovalenko deleted the feat/optimize-gc branch April 29, 2024 15:24
let diffLinesStack = Stack.create () in
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