3 ms·
Android has a big fundamental advantage over iPhone OS: Garbage Collection. This is generally considered to be 30-40% overhead on debugging time.
by stcredzero 17y ago
Android has a big fundamental advantage over iPhone OS: Garbage Collection. This is generally considered to be 30-40% overhead on debugging time.
- dschobel 17y agoIt's still amazing to me how powerful these devices have become that you can put a GC on a mobile platform, especially considering how sensitive users would be to GC stalls causing unresponsive user interfaces.
- samstokes 17y agoI'm pretty sure modern garbage collectors don't have that "stop the world" behaviour that causes unresponsiveness. And tens of millions of J2ME-capable phones have been running garbage collectors for years. (And while J2ME has a reputation for slowness, that's mostly about startup time, and anyway it's largely due to bad coding rather than the runtime being inherently slow. Opera Mini and the J2ME version of Google Maps are both more responsive than many "native" apps.)
- ori_b 17y agoMany of them do have stop-the-world GC. A well implemented stop the world GC allows higher throughput, at the cost of increased latency. This is especially the case when provably-local allocations can be put onto a thread-local heap, and you only do stop-the-thread GC on those. So, in the absolute sense, stop-the-world GC overhead is lower than incremental, low-latency GC. But yes, we have GC that is fairly responsive these days, too, for when throughput isn't the driving concern.
- stcredzero 17y agoIt's still amazing to me how powerful these devices have become that you can put a GC on a mobile platform Really? Colleagues have told me of applications using GC that ran on 486 with good performance. The popular notions of what dynamic languages and GC are like are literally decades out of whack. This is a self perpetuating phenomenon, which is why you can have popular languages that are between 1 and 2 orders of magnitude slower than they should be. (Outdated GC being a prominent factor.)
- dschobel 17y agoI remember the GC stalls being quite apparent for swing applications which I wrote in undergrad back in the 2000 to 2002 time frame (so it must have been java 1.3). Highly responsive UI and relatively low system memory (256MB on the G1) just strikes as quite the feat on top of a GC language. Although you're right, I may just be dating myself.
- stcredzero 16y agoBack in 2000, Java VMs were still lagging behind Smalltalk VMs, especially in real-world performance.
- briancooley 17y agoOTOH, you can still leak memory in Android by holding references to unneeded resources, particularly Contexts. http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html http://android-developers.blogspot.com/2009/01/avoiding-memo... It's a different sort of problem, but you have to be careful either way. There is a subtle benefit to having been forced to manage reference counts.
- stcredzero 17y agoThis is a problem in all GC environments, but the amount of effort required to avoid that (exceptional) situation is an order of magnitude less. There is still a big win for GC.
- pkulak 17y agoI've heard from some people that garbage collection is the reason Android scrolling is never quite as smooth as an iPhone. I don't know if that's true, but if it is, I'd rather just manage my own memory. It's really easy once you get the hang of it. Header files are more of a pain to me than memory management is.
- stcredzero 17y agoIt's really easy once you get the hang of it. You are 100% with memory management? The problem is not the 99.99% of the time when you do it right. It's the other time when you do it wrong, and debugging that. Have you actually tracked the time/effort? Can you quantify what memory leaks are costing your project?
- pkulak 17y agoI'm not saying that it's easy, or that it doesn't take any time or effort. But if garbage collection makes your app scroll like crap, then the effort is probably worth it, don't you think?
- stcredzero 17y agoThat's a pretty naive assumption about the uniformity of GC performance across all implementations and algorithms.