GithubHelp home page GithubHelp logo

Dex file size increases by ~50% without making changes (DexFileFactory.loadDexFile then DexFileFactory.writeDexFile) about smali HOT 7 OPEN

marwan-bushara avatar marwan-bushara commented on July 21, 2024
Dex file size increases by ~50% without making changes (DexFileFactory.loadDexFile then DexFileFactory.writeDexFile)

from smali.

Comments (7)

CunningLogic avatar CunningLogic commented on July 21, 2024 1

@katzdan after I get the brisket going on the smoker, I will post a detailed explanation. I deleted my far too simple reply (im just waking up and was being a bit lazy). I do think there is something else going on here too, but I need to run them through my disassembler to look closer.

but yes, there is a lot of duplicate data in a dex file, and a lot of data is pointed to with pointers/offsets.

For example, if two classes have identical debug sections, both can point to the same data for their debug section.

from smali.

CunningLogic avatar CunningLogic commented on July 21, 2024

post the before/after dex and ill take a look

from smali.

marwan-bushara avatar marwan-bushara commented on July 21, 2024

I'm attaching one example here. The size increase is about 40% in this case.
classes.zip

from smali.

katzdan avatar katzdan commented on July 21, 2024

Hi, I'm following this issue as well.
Not sure what you mean by "modern optimizing compiler". Is there a way to reduce the changes in size between the initial dex file and the one written?
Thanks

from smali.

CunningLogic avatar CunningLogic commented on July 21, 2024

@katzdan @marwan-bushara

The after file is 3322156 bytes longer
the debug section accounts for 46276 of those bytes

TLDR: at least a good chunk of the difference is because smali does not employ some of the space saving tricks that some compilers do, by not writing duplicate data, and by pointing multiple references at the same data

from smali.

katzdan avatar katzdan commented on July 21, 2024

Is there any hope to get a reduction in the size of a Dex in the future? as an optimization feature?

from smali.

CunningLogic avatar CunningLogic commented on July 21, 2024

@katzdan there are a number of ways to do that, it would be fairly easy.

Easiest route would be to just write a script to parse the smali files and remove debug information and dead code

from smali.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.