-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
We should test whether it is faster, in the happy case, to check things like array bounds, or to just catch and rethrow IonException. Catching and rethrowing is slower in the error case, but we're not as concerned about the performance for error cases. In the happy case, it might be faster because we eliminate checks that are going to happen intrinsically as part of the array access.
E.g.:
if (i < 0 || i >= myArray.size) {
throw IonException("Invalid something...")
}
val x = myArray[i]vs.
val x = try {
myArray[i]
} catch (e: ArrayIndexOutOfBoundsException) {
throw IonException("Invalid something...")
}Metadata
Metadata
Assignees
Labels
No labels