CalebFenton / simplify

Android virtual machine and deobfuscator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

performance, SmaliClassLoader.loadClass()

ehsmeng opened this issue · comments

Hi,
Is the following performance optimization ok, or am I missing something crucial here?
Thanks!

smalivm.diff.txt
before
after

Ahh yeah, neither ClassManager.getFrameworkClassNames() nor ClassManager.getNonFrameworkClassNames() cache the results of filtering the keys. This is certainly something that could be changed. I think a better place to cache this is in ClassManager so any callers of that method could benefit from the cache, and also might as well cache getNoneFrameworkClassNames.

I'm curious though -- if you're profiling the code, it's true that a lot of the initial work is done loading classes and getting the VM initialized, but in my experience, this load becomes completely trivial after the execution starts. Have you profiled execution of any non-trivial methods? Or are you just calling this method a lot in your particular use case? If so, could you explain your use case a bit? -- I'm curious.

I'm going to close this since I've adapted the change, but I'm still curious about my questions above.

Hi, thanks for accepting the patch.

I would like to call the same method with a lot of permutations of arguments. It seems like it is possible to call VirtualMachine.execute() several times, and only the first time takes a init hit, and from that point of view you're right in that this optimization is not that necessary :)