I have some nested inline calls in my code base (Ktor Server), just wanted to know does these nested calls have any performance impact or any negative impact? if yes, how do i make sure that i’m keeping them as minimum possible.
Thanks in advance!
suspend inline fun <reified T:Request> withRequest(block: (T) -> Unit){
val request = receive<T>()
if(request.isValidRequest()){
block(request)
}else{
throw InvalidInputs()
}
}
suspend inline fun computeResponse(...) {
.. Measure Time...
...Compute Logic ...
}
suspend inline fun authorizedUser(
status: Int
requiredPrivilege: Int,
block: (UserPrincipal, Int) -> ApiResponse
) {
.... Check Privilege and ExecuteBlock
}
authorizedUser(200){ prinicpal,status
withRequest<DataRequest>{ request ->
computeResponse{
dataProviderService.getData(principal.userID,request.dataID).toApiResponse();
}
}
}