5 ms·
Just a side question, the author mentions method count as a downside of introducing alternate JVM languages. Does the method could slowdown/bloat apps somehow?
by PudgePacket 12y ago
Just a side question, the author mentions method count as a downside of introducing alternate JVM languages. Does the method could slowdown/bloat apps somehow?
- thefreeman 12y agoNo, but older Android versions have a maximum 64000 method limit. I think it has been fixed for later versions, but I am really not sure. There have been some blog posts about Facebook's (controversial) attempts to work around this limit: https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920 https://www.facebook.com/notes/facebook-engineering/under-th...
- cypher543 12y agoAndroid 4.0 introduced a new set of Dalvik instructions that supported larger methods IDs, but they were never used and were eventually removed. ART may have lifted the method limit, but I haven't seen any specific mention of it.
- jc4p 12y agoART does not lift it. I was at the I/O session where the ART team explicitly stated that.
- ZoFreX 12y agoNot older. All. It's a limitation of the file format, not the runtime. It's a common misconception that it's fixed in later versions, because Facebook ran into a very similar (but different) problem that is fixed on newer devices (the one you linked to).
- masklinn 12y agoIt's way more fucked up than that, Dalvik is limited to 65k invocable methods per dex file: https://medium.com/@rotxed/dex-skys-the-limit-no-65k-methods-is-28e6cb40cf71 https://medium.com/@rotxed/dex-skys-the-limit-no-65k-methods... > You can reference a very large number of methods in a DEX file, but you can only invoke the first 65536, because that’s all the room you have in the method invocation instruction. > […] the limitation is on the number of methods referenced, not the number of methods defined. If your DEX file has only a few methods, but together they call 70,000 different externally-defined methods, you’re going to exceed the limit.
- michaelcampbell 12y agoIs this limitation going away (or otherwise obviated) by ART?
- izacus 12y agoNo it's not - the limitation is part of DEX file format (it only has 16-bit method counter). ART is a runtime which runs these DEX files so it can't help there. To change this, Google would have to update the file format and somehow ensure dual format compatibility when running.
- myko 12y agoYes, but not just yet: https://plus.google.com/107130354111162483072/posts/VEy3JChn3N2 https://plus.google.com/107130354111162483072/posts/VEy3JChn... Mentioned at about 27:55 in this podcast where a member of the ART team is interviewed: http://androidbackstage.blogspot.se/2014/08/android-developers-backstage-episode-11.html?m=1 http://androidbackstage.blogspot.se/2014/08/android-develope...
- masklinn 12y agoYou're talking about a similar but different issue: there's a fixed-size meta-information buffer, if you go above you crash. Increase the size of the buffer and you're good to go (which is what more recent android versions have done), the new ART might make the buffer dynamic instead of static (no idea). The 65k method problem is a problem of the dex format itself, because method-invocation instructions take "the method" as a 16-bit index, it can't be fixed by the runtime, the dex format has to be changed to fix it (either by adding new opcodes or by changing existing ones).
- myko 12y agoI think you are mistaken - in the audio: http://storage.googleapis.com/androiddevelopers/android_developers_backstage/Android%20Developers%20Backstage%20Ep%2011%20ART%2C%20pART%202%20%28Trash%20Talk%29.mp3 http://storage.googleapis.com/androiddevelopers/android_deve... Around 27:55 they discuss that they plan on lifting the limit. Indeed modifying the dex format is talked about and it is mentioned that it is a future goal. They also speak about multidex, the interim backwards compatible fix which does not require modifying the dex format (but uses a hack) and will make modifying the dex format easier in the future.
- on_and_off 12y agoNo. However, there is a hard 65k limit to the number of methods that the dex format can manage. The libraries enter into account, with google play service taking 20k entries. All is not lost though : the limitation is going to go away in the near future.