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

batch optimization #187

Open
liesauer opened this issue Jul 12, 2024 · 1 comment
Open

batch optimization #187

liesauer opened this issue Jul 12, 2024 · 1 comment

Comments

@liesauer
Copy link

let's says i want to doing this:

  1. saturate
  2. darken
  3. wartermark

when it runs, the actual code is something like this

for (x, y) in dimensions {
    // saturate
}
for (x, y) in dimensions {
    // darken
}
for (x, y) in dimensions {
    // watermark
}

with batch optimization, it can be

for (x, y) in dimensions {
    // saturate + darken + watermark
}

it will save tons of loops, is there any feature plans doing this?

i am not english native speaker neither nor a professor on image processing, hope the description clear enough.

@liesauer
Copy link
Author

making

for (x, y) in dimensions {
    pixels[x][y] = pixels[x][y] + 1;
}
for (x, y) in dimensions {
    pixels[x][y] = pixels[x][y] * 2;
}

into

for (x, y) in dimensions {
    pixels[x][y] = (pixels[x][y] + 1) * 2;
}

same result but fewer loops

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

No branches or pull requests

1 participant