graal icon indicating copy to clipboard operation
graal copied to clipboard

Better way to avoid unused fields being dead-code eliminated

Open galderz opened this issue 1 year ago • 2 comments

Foivos recently realised that padding fields added to classes get dead-code eliminated in native image.

Performance sensitive code often relies in tricks like that to avoid fail sharing. For native image, one could add register those fields for reflection access, but that's a fairly expensive thing to do in terms of build times, native executable size...etc. It would be nice to have a way to register fields such that they don't get dead-code eliminated.

galderz avatar Apr 11 '24 12:04 galderz

To paraphrase @zakkak, something akin to query* but opposite.

galderz avatar Apr 11 '24 12:04 galderz

The thing is: it really matter? false sharing is a problem for high concurrent and high thoughput contended uses cases: sometime is just not worthy and having smaller dataset is better, so...let's think about it where it happens...and I can help to detect the hot spots, see https://github.com/netty/netty/issues/12496 and https://github.com/netty/netty/issues/13945

franz1981 avatar Apr 11 '24 12:04 franz1981

I believe @franz1981 has provided a useful answer here. In any case, if you still believe this to be relevant, please create a new issue for it.

oubidar-Abderrahim avatar Aug 01 '24 09:08 oubidar-Abderrahim