Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Performance hit of Thread.currentThread()

Most SWT method calls start with `checkWidget()`, which calls `Thread.currentThread()`.

I haven't profiled it myself, but Lint4j claims that this is an expensive method call:
http://www.jutils.com/checks/performance.html

Has anyone quantified the performance impact of these calls?

An alternative would be to introduce an `@SwtThread` annotation, and use `javaagent` to enable a "debug mode" where the thread is checked, and then not check them at runtime for release builds.

Here is a project which uses a similar approach for Swing:
https://github.com/sjappig/threadannotations

Just curious if anyone else has looked at this :)

-Ned

Back to the top