You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The current implementation of WrappedDataWatcher#hasIndex makes use of method public Object getObject(WrappedDataWatcher.WrappedDataWatcherObject object). In order for this method to return null, or, in other words, in order for hasIndex to return false, a NullPointerExceptionor an InvocationTargetException must be thrown and handled:
(see screenshot 1)
This solution is slow in scenarios where hasIndex is called very often (for example, when using a custom data watcher to create cross-compatible packet NPCs):
(see screenshot 2)
To Reproduce
Steps to reproduce the behavior:
Use method hasIndex of WrappedDataWatcher often enough, e.g. in a custom data watcher for cross-compatible packet NPCs.
Create a Java Flight Recording.
Enjoy a ton of NullPointerExceptions and even more InvocationTargetExceptions in the exceptions tab.
Expected behavior
I would really appreciate it if this method was faster and avoided use of any try/catch statements and exception handlers, so that it may be called very frequently without negative performance consequences.
Describe the bug
The current implementation of
WrappedDataWatcher#hasIndex
makes use of methodpublic Object getObject(WrappedDataWatcher.WrappedDataWatcherObject object)
. In order for this method to returnnull
, or, in other words, in order forhasIndex
to returnfalse
, aNullPointerException
or anInvocationTargetException
must be thrown and handled:(see screenshot 1)
This solution is slow in scenarios where
hasIndex
is called very often (for example, when using a custom data watcher to create cross-compatible packet NPCs):(see screenshot 2)
To Reproduce
Steps to reproduce the behavior:
hasIndex
ofWrappedDataWatcher
often enough, e.g. in a custom data watcher for cross-compatible packet NPCs.NullPointerException
s and even moreInvocationTargetException
s in the exceptions tab.Expected behavior
I would really appreciate it if this method was faster and avoided use of any
try/catch
statements and exception handlers, so that it may be called very frequently without negative performance consequences.Screenshots
Version Info
https://pastebin.com/7bi3qARm
Additional context
High load.
The text was updated successfully, but these errors were encountered: