"choose between cutting significant features from the app or only shipping our new version to the newest Android phones (ICS and up)" The ICS move wouldn't have been a bad option. It would've helped a lot of users convert to ICS+ devices, which Google probably would've loved. The APIs from 4+ are much more robust than pre-ICS, and it probably would've saved more headaches while building the new version in addition to…
Dalvik patch for Facebook for Android
51–60 of 95 posts
Re: Dalvik patch for Facebook for Android
#52Earlier quoted context omitted.
In order to elide the out-of-line method the compiler must statically prove that it is impossible call outside the visibility of its optimization scope. I'm not familiar with Java compilers but I'd hazard a guess that to exploit this optimization (if it were possible at all) they would probably have to significantly rework their code.
For a shipped app it shouldn't be too hard to perform it across all packages involved, right?
In Java land these kinds of fancy optimizations usually happen in the JVM JIT at runtime. Would this help the size of those tables in Android's Dalvik/dexopt setup? In any case you can't ship a custom version of Dalvik with your app.
Re: Dalvik patch for Facebook for Android
#53Earlier quoted context omitted.
Three million methods? Having both programmed for Android and having used the Facebook App for Android, I find it very difficult to believe that app has anywhere near 3 million methods, even if each one is basically a one-liner. If the number is correct, that really is some kind of crazytown code.
I think the actual number is 65536 or similar — the 3 million may have been a misquote by TechCrunch.
Re: Dalvik patch for Facebook for Android
#54Re: Dalvik patch for Facebook for Android
#55Earlier quoted context omitted.
In order to elide the out-of-line method the compiler must statically prove that it is impossible call outside the visibility of its optimization scope. I'm not familiar with Java compilers but I'd hazard a guess that to exploit this optimization (if it were possible at all) they would probably have to significantly rework their code.
For a shipped app it shouldn't be too hard to perform it across all packages involved, right?
Actually, even in plain, reflection-less java it may be quite complicated because subclass methods can be invoked by superclass-typed variables. For every method invocation you need to find all possible subclasses whose objects can be assigned to variable on which the method is invoked. You need to know which subclasses are ever passed as superclass/interface arguments to methods. You need to know which subclasses are assigned to superclass/interface member/static variables. You need to know which subclasses are stored in superclass collections. And so on.
Re: Dalvik patch for Facebook for Android
#56This seems like it will paint the Android core developers into a corner, supporting this particular hack for years to come, like the way Microsoft had to for Windows. If I were android core developers, this would not be a good day.
Re: Dalvik patch for Facebook for Android
#57According to http://techcrunch.com/2013/03/04/facebook-google-dalvik/ and http://venturebeat.com/2013/03/04/google-facebook-android/ , the specific limit being hit was a cap of three million methods per instance of the Dalvik VM. Wisdom of a three-million-method app aside, I wonder why they didn't fix this in the compilation toolchain rather than by poking around in native memory areas during app startup. Facebook wr…
"Even though I disagree with most of your comments (to the extent that it is any more than unrelated editorializing) and everyone talking about "too many methods" etc, the actual bug that was triggered is here and provides a test case: https://code.google.com/p/android/issues/detail?id=22586 showing that multiple interface inheritance triggers this easily."
Issue 22586 - android - Dexopt fails with "LinearAlloc exceeded" for deep interface hierarchies
Re: Dalvik patch for Facebook for Android
#58Uninstalled. I checked, and Facebook took up more memory than any other application I have installed, even more than TSF Shell. (By the way, a MUCH more "feature-rich," useful, and snappy app than facebook!) Facebook isn't doing anything comparable to what TSF Shell does, not for me anyway. I bet this is why my phone recently started taking 30 seconds to make a phonecall (!). I can't believe an app requires 8M RAM ju…
It would be interesting to know what it is doing to be that complex. I'm guessing lots of third party libraries for ads, logging, etc?
Re: Dalvik patch for Facebook for Android
#59"We were certainly glad and grateful that Android is open source—otherwise, this change wouldn’t have been possible." In return, maybe you could open-source some of your app, for example?
We do already open source a wide variety of projects, for those who aren't already aware: https://github.com/facebook
Re: Dalvik patch for Facebook for Android
#60>>> It seemed like we would have to choose between cutting significant features from the app or only shipping our new version to the newest Android phones (ICS and up). Neither seemed acceptable. We needed a better solution. This . "There has to be a better solution", a quality which defines hackers - is it not? It's that pushing the boundaries for the sake of getting things done that drive progress, isn't it? It's t…
Solution: Destroy the moon.