RFR: 8313697: [XWayland][Screencast] consequent getPixelColor calls are slow [v2]

Alexander Zvegintsev azvegint at openjdk.org
Mon Aug 14 05:51:58 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.

Alexander Zvegintsev has updated the pull request incrementally with two additional commits since the last revision:

 - switch to java.util.Timer
 - Make multiple calls to doCleanup() safe

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/15250/files
  - new: https://git.openjdk.org/jdk/pull/15250/files/60ea277a..0b6e8f46

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15250&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15250&range=00-01

  Stats: 34 lines in 2 files changed: 21 ins; 11 del; 2 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