RFR: 8313697: [XWayland][Screencast] consequent getPixelColor calls are slow
Alexander Zvegintsev
azvegint at openjdk.org
Fri Aug 11 17:41:31 UTC 2023
Right now, each call to getPixelColor/createScreenCapture opens and closes a ScreenCast session.
When there are many such calls in a row, it becomes a rather time-consuming operation.
For example,
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
robot.getPixelColor(i, j);
}
}
`50x50 took 375219ms`
This fix offers optimization by keeping the session open and closing it only 2 seconds after the last activity.
`50x50 took 28113ms` which is ~ 13 times faster.
Testing looks good.
-------------
Commit messages:
- Handle the case where a new screen capture requires a token different from the one used by the current session.
- initial
Changes: https://git.openjdk.org/jdk/pull/15250/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15250&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8313697
Stats: 161 lines in 7 files changed: 111 ins; 23 del; 27 mod
Patch: https://git.openjdk.org/jdk/pull/15250.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15250/head:pull/15250
PR: https://git.openjdk.org/jdk/pull/15250
More information about the client-libs-dev
mailing list