From f03786bc55a9cc8be775aa01e2dc5df1b2c43142 Mon Sep 17 00:00:00 2001 From: Sergey Sayamov Date: Thu, 26 Feb 2026 22:53:42 +0300 Subject: [PATCH 1/2] Add LRUCache to AndroguardImp.lowerfunc --- quark/core/apkinfo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/quark/core/apkinfo.py b/quark/core/apkinfo.py index a764836b..b9941dcc 100644 --- a/quark/core/apkinfo.py +++ b/quark/core/apkinfo.py @@ -111,6 +111,7 @@ def upperfunc(self, method_object: MethodObject) -> Set[MethodObject]: for _, call, _ in method_analysis.get_xref_from() } + @functools.lru_cache() def lowerfunc(self, method_object: MethodObject) -> Set[MethodObject]: method_analysis = method_object.cache return { From d3f61ff0cf4c92899fc4a687deb5bd98c6a161b2 Mon Sep 17 00:00:00 2001 From: Sergey Sayamov Date: Thu, 26 Feb 2026 22:58:25 +0300 Subject: [PATCH 2/2] Move call to lowerfunc outside of loop --- quark/core/quark.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quark/core/quark.py b/quark/core/quark.py index 3b222c94..64f5a1c1 100644 --- a/quark/core/quark.py +++ b/quark/core/quark.py @@ -164,13 +164,14 @@ def check_sequence( :return: True or False """ state = False + mutual_parent_lowerfunc = self.apkinfo.lowerfunc(mutual_parent) for first_call_method in first_method_list: for second_call_method in second_method_list: seq_table = [ (call, number) - for call, number in self.apkinfo.lowerfunc(mutual_parent) + for call, number in mutual_parent_lowerfunc if call in (first_call_method, second_call_method) ]