JesusFreke / smali

smali/baksmali
6.29k stars 1.07k forks source link

Avoid exceptions to increase performance #827

Closed StevenArzt closed 2 years ago

StevenArzt commented 2 years ago

The collection utils used to call next() on an iterator and catch the exception in case there is no next element. This is not optimal, because exceptions are notoriously slow in Java, mainly due to stack trace building. Instead, we should call hasNext().

JesusFreke commented 2 years ago

Thanks! Squashed, reformatted a bit, and merged as 330c365e8c3e811a7a409593ffce1a7c07f1f043