Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
aad70c71
Commit
aad70c71
authored
Jun 12, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: cache types in dex nodes
parent
a051ce6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
DexNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
+11
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
View file @
aad70c71
...
...
@@ -38,12 +38,14 @@ public class DexNode implements IDexNode {
private
final
List
<
ClassNode
>
classes
=
new
ArrayList
<>();
private
final
Map
<
ClassInfo
,
ClassNode
>
clsMap
=
new
HashMap
<>();
private
final
ArgType
[]
typesCache
;
public
DexNode
(
RootNode
root
,
DexFile
input
,
int
dexId
)
{
this
.
root
=
root
;
this
.
file
=
input
;
this
.
dexBuf
=
input
.
getDexBuf
();
this
.
dexId
=
dexId
;
this
.
typesCache
=
new
ArgType
[
dexBuf
.
typeIds
().
size
()];
}
public
void
loadClasses
()
{
...
...
@@ -207,7 +209,15 @@ public class DexNode implements IDexNode {
if
(
index
==
DexNode
.
NO_INDEX
)
{
return
null
;
}
return
ArgType
.
parse
(
getString
(
dexBuf
.
typeIds
().
get
(
index
)));
ArgType
type
=
typesCache
[
index
];
if
(
type
!=
null
)
{
return
type
;
}
// no synchronization because exactly one ArgType instance not needed, just reduce instances count
// note: same types but different instances will exist in other dex nodes
ArgType
parsedType
=
ArgType
.
parse
(
getString
(
dexBuf
.
typeIds
().
get
(
index
)));
typesCache
[
index
]
=
parsedType
;
return
parsedType
;
}
public
MethodId
getMethodId
(
int
mthIndex
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment