From 167ac71f3fbaee0c20a272ac85f36b323302a056 Mon Sep 17 00:00:00 2001 From: Felix Bergmann Date: Tue, 31 Jul 2018 23:59:51 +0200 Subject: [PATCH 1/2] Performance issue fix Use indexOf with character instead of string improves performance. --- .../main/java/com/orhanobut/logger/PrettyFormatStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java b/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java index 74e33ad5..308b82cb 100644 --- a/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java +++ b/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java @@ -180,7 +180,7 @@ private void logChunk(int priority, @Nullable String tag, @NonNull String chunk) private String getSimpleClassName(@NonNull String name) { checkNotNull(name); - int lastIndex = name.lastIndexOf("."); + int lastIndex = name.lastIndexOf('.' ); return name.substring(lastIndex + 1); } From cb96b402c00ab492e6f513c612e834378e722e23 Mon Sep 17 00:00:00 2001 From: Felix Bergmann Date: Wed, 1 Aug 2018 00:03:03 +0200 Subject: [PATCH 2/2] Update PrettyFormatStrategy.java --- .../main/java/com/orhanobut/logger/PrettyFormatStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java b/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java index 308b82cb..c3882656 100644 --- a/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java +++ b/logger/src/main/java/com/orhanobut/logger/PrettyFormatStrategy.java @@ -180,7 +180,7 @@ private void logChunk(int priority, @Nullable String tag, @NonNull String chunk) private String getSimpleClassName(@NonNull String name) { checkNotNull(name); - int lastIndex = name.lastIndexOf('.' ); + int lastIndex = name.lastIndexOf('.'); return name.substring(lastIndex + 1); }