From 2bc5f58992b07d17a199e609dc9b77987c460811 Mon Sep 17 00:00:00 2001 From: Janne Koschinski <janne@kuschku.de> Date: Fri, 2 Mar 2018 03:00:43 +0100 Subject: [PATCH] Attempts at improving performance --- app/redex.config | 111 ++++++++++++++++-- .../primitive/serializer/StringSerializer.kt | 5 +- 2 files changed, 99 insertions(+), 17 deletions(-) diff --git a/app/redex.config b/app/redex.config index 83ea89dcf..54f7cc70f 100644 --- a/app/redex.config +++ b/app/redex.config @@ -1,36 +1,121 @@ { "redex" : { "passes" : [ + "MethodDevirtualizationPass", "ReBindRefsPass", - "SynthPass", "FinalInlinePass", - "PeepholePass", - "ConstantPropagationPassV3", - "RedundantMoveEliminationPass", - "LocalDcePass", - "RemoveGotosPass", "DelSuperPass", "SingleImplPass", - "StaticReloPass", + "PeepholePass", + "ConstantPropagationPass", + "LocalDcePass", + "AnnoKillPass", "ReorderInterfacesPass", "RemoveEmptyClassesPass", + "SingleImplPass", + "InterDexPass", + "RemoveGotosPass", + "DedupBlocksPass", "ShortenSrcStringsPass", - "InstructionSelectionPass" + "RegAllocPass", + "CopyPropagationPass", + "LocalDcePass", + "DedupBlocksPass", + "StripDebugInfoPass" ] }, + "RegAllocPass" : { + "live_range_splitting": "0" + }, "SimpleInlinePass": { - "use_liveness" : true, "throws": true, - "multiple_callers": true + "multiple_callers": true, + "no_inline_annos" : [ + "Lcom/fasterxml/jackson/databind/annotation/JsonDeserialize;" + ], + "black_list": [], + "caller_black_list": [] + }, + "ShortenSrcStringsPass" : { + "filename_mappings" : "filename_mappings.txt" }, "FinalInlinePass" : { "propagate_static_finals": true, "replace_encodable_clinits": true, - "inline_string_fields": true, - "inline_wide_fields": true + "black_list_types" : [] + }, + "AnnoKillPass" : { + "keep_annos": [ + "Landroid/view/ViewDebug$CapturedViewProperty;", + "Landroid/view/ViewDebug$ExportedProperty;", + "Landroid/webkit/JavascriptInterface;", + "Landroid/widget/RemoteViews$RemoteView;", + "Lcom/google/android/gms/common/annotation/KeepName;" + ], + "kill_annos" : [ + "Lcom/google/inject/BindingAnnotation;" + ], + "force_kill_annos" : [ + "Ldalvik/annotation/EnclosingClass;", + "Ldalvik/annotation/EnclosingMethod;", + "Ldalvik/annotation/InnerClass;", + "Ldalvik/annotation/MemberClasses;", + "Ldalvik/annotation/Throws;" + ] }, - "RedundantMoveEliminationPass" : { + "ConstantPropagationPass" : { + "blacklist": [], + "replace_moves_with_consts": true, + "fold_arithmetic": true + }, + "CopyPropagationPass" : { "eliminate_const_literals": false, "full_method_analysis": true + }, + "MethodDevirtualizationPass" : { + "staticize_vmethods_not_using_this" : true, + "staticize_dmethods_not_using_this" : true + }, + "StripDebugInfoPass" : { + "drop_all_dbg_info" : "0", + "drop_local_variables" : "1", + "drop_line_numbers" : "0", + "drop_src_files" : "0", + "use_whitelist" : "0", + "cls_whitelist" : [], + "method_whitelist" : [], + "drop_prologue_end" : "1", + "drop_epilogue_begin" : "1", + "drop_all_dbg_info_if_empty" : "1" + }, + "PeepholePass" : { + "disabled_peepholes": [ + "Replace_PutGet", + "Replace_PutGetWide", + "Replace_PutGetObject", + "Replace_PutGetShort", + "Replace_PutGetChar", + "Replace_PutGetByte", + "Replace_PutGetBoolean" + ] + }, + "keep_packages": [ + "Lcom/fasterxml/jackson/", + "Lcom/google/dexmaker/mockito/" + ], + "keep_annotations": [ + "Lcom/google/common/annotations/VisibleForTesting;" + ], + "proguard_map_output": "redex_pg_mapping.txt", + "stats_output": "stats.txt", + "bytecode_offset_map": "bytecode_offset_map.txt", + "line_number_map_v2": "redex-line-number-map-v2", + "method_move_map" : "redex-moved-methods-map.txt", + "string_sort_mode" : "class_order", + "bytecode_sort_mode" : "class_order", + "ir_type_checker": { + "run_after_each_pass" : false, + "polymorphic_constants" : false, + "verify_moves" : false } } diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt index bf240b735..ae2286048 100644 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt +++ b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt @@ -25,14 +25,13 @@ abstract class StringSerializer( } ) - //private val charBuffer = ThreadLocal<CharBuffer>() + private val charBuffer = ThreadLocal<CharBuffer>() object UTF16 : StringSerializer(Charsets.UTF_16BE) object UTF8 : StringSerializer(Charsets.UTF_8) object C : StringSerializer(Charsets.ISO_8859_1, trailingNullByte = true) private inline fun charBuffer(len: Int): CharBuffer { - /* if (charBuffer.get() == null) charBuffer.set(CharBuffer.allocate(1024)) val buf = if (len >= 1024) @@ -42,8 +41,6 @@ abstract class StringSerializer( buf.clear() buf.limit(len) return buf - */ - return CharBuffer.allocate(len) } override fun serialize(buffer: ChainedByteBuffer, data: String?, features: Quassel_Features) { -- GitLab