Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk code cache and search rewrite #1483

Merged
merged 7 commits into from
May 18, 2022
Merged

Disk code cache and search rewrite #1483

merged 7 commits into from
May 18, 2022

Conversation

skylot
Copy link
Owner

@skylot skylot commented May 14, 2022

New code cache option: save decompilation results on disk.
This allows to reopen project without additional decompilation and reduce memory usage.
Also, search was heavily modified to support slow loading from disk.

Implementation details:

  1. Disk cache:
    • saved in directory *.cache near project file or loaded file
    • stores separately code file and code metadata (custom binary format with .jadxmd extension).
      This allows to load only code for text search
    • cache files reset on decompilation option changes, data format version and options hash stored in code-version file
  2. Search changes:
    • search results now limited, with new buttons to load more results or load all.
      This reduces search time if all results not really needed.
    • executed in parallel
    • cancelable: new methods added to background executor for better task canceling

Added new option to change code cache, possible values:

Option Description Memory usage Reload or first search Search speed
Memory Everything in memory High Slow Fast
Disk with cache (default) Save code info on disk with memory limited cache for code strings Medium Medium Medium
Disk Code info stored on disk Low Medium Slow*

* Depends on OS disk caching (on Linux files often loaded into memory and performance similar Disk with cache option)


Breaking changes to jadx API:

  • ICodeInfo: lines and code annotations moved to new interface ICodeMetadata with helpful search methods
  • Changes for all code annotations methods to use ICodeAnnotation instead Object.

If possible, please try this changes and share your thoughts, suggestions and bugs 🤣

Fixes #444

@lgtm-com
Copy link

lgtm-com bot commented May 14, 2022

This pull request introduces 1 alert when merging 3788555 into 65ade37 - view on LGTM.com

new alerts:

  • 1 for Use of a broken or risky cryptographic algorithm

@lgtm-com
Copy link

lgtm-com bot commented May 17, 2022

This pull request introduces 1 alert when merging fee77c5 into 65ade37 - view on LGTM.com

new alerts:

  • 1 for Use of a broken or risky cryptographic algorithm

@jpstotz
Copy link
Collaborator

jpstotz commented May 17, 2022

@skylot According to the documentation you should be able to suppress the lgtm warning regarding MD5 by adding a comment at the end of that line:

MessageDigest md = MessageDigest.getInstance("MD5"); /* lgtm[java/weak-cryptographic-algorithm] */

@skylot
Copy link
Owner Author

skylot commented May 17, 2022

@jpstotz thanks. But it also triggers warning in CodeQL scan, so I will just ignore that warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snapshot or session file to restore for analysis multiple times
2 participants