Skip to content

Fast Arn.fromString implementation #6108

Open
@rgithubli

Description

@rgithubli

Describe the feature

When parsing arn from a string, while throwing an exception is a way to convey the string is invalid, it's expensive, especially if it's on a hot code path and the client doesn't use the stacktrace at all. code. Based on internal Amazon profiling results, it can cause > 5% CPU cycles for some of the services to fill the stack trace when parsing arn, while spending >1% CPU cycles on exceptions can be considered needing optimizations.

To improve the performance, we can provide an API that doesn't throw exception, e.g. the API returns an Optional or throws exception but overrides its fillInStackTrace to avoid the expensive stacktrace filling.

Use Case

Arn.fromString parsing takes long CPU cycle due to unnecessary stacktrace filling.

Proposed Solution

Keep existing Arn.fromString API but also provide another API that either returns Optional or throws exception that does not fill stacktrace.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

Both v1 and v2

JDK version used

17, but it doesn't matter

Operating System and version

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions