airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
200 stars 11 forks source link

[Feature request] AOT compilation builds on Android #145

Open neuronix opened 4 years ago

neuronix commented 4 years ago

Hi guys,

With Harman committing to support AIR and hoping to commercialize it for a long time I think investigating AOT compilation for Android would be a good idea.

Indeed, AIR is great, it's easy to use, robust and honestly perfect for 2D games and most application cases. The only real issue (for us at least) is that performance on Android is pretty atrocious and as apps/games are expected to be more complex, AIR is harder to use because we have to cater for the experience on low budget Android devices.

Apps generally work fine on the high end devices, but Android is an ocean of 10,000 different devices of which 80% are low-end cheap devices, and we have to jump though hoops to get things to work on these devices, degrading user experience along the way.

The irony of the situation is that we have on the iOS side high-end powerful devices with a high performance AOT build and on the other, dirt cheap low-end devices with a very heavy VM implementation.

Although Harman plan to improve memory & texture thresholds which is good news, the main bottleneck is just the plain Actionscript execution speed and I believe AOT would significantly boost it. Indeed older iOS devices often perform better than newer Android devices of similar performance brackets just because of the Actionscript limitation.

I have no clue what amount of work would be required to bring AOT to Android. I only hope that when Adobe did it for iOS, they did think further than iOS, and that some of that work is reusable!

In any case, if possible, I sincerely think that it would be a significant improvement for developers and for Harman, it would extend the potential lifetime of AIR as a relevant tool for mobile app/game development.

Thanks

ajwfrost commented 4 years ago

Hi - this is an interesting idea. I'll discuss with the Adobe folk as to why this wasn't actually done.. there are obviously some limitations with iOS that result from this, i.e. not being able to load in a separate SWF that has code in it, but I would hope that we could get a compromise sort of situation perhaps...

Of course on Android we have four different potential CPU architectures (ignoring MIPS!) which could make things a little more of a challenge. But we'll add this to the wishlist and see what could be done.

Thanks for the suggestion!

leossmith commented 4 years ago

AOT for android would be a major upgrade in AIR sdk. This will increase performance a lot in most Android devices. If I remember correctly, Adobe did the AOT for iOS when Apple restricted what apps could be uploaded.

I remember they said that AOT will come to android but it kept using an interpreter.

Can't wait to see this coming to AIR

angelhdzmultimedia commented 4 years ago

I agree with everything said, nothing to add, so I vote for AOT.

harpwood commented 4 years ago

+1 vote from me too!

neuronix commented 4 years ago

@ajwfrost Thanks for your quick reply Andrew. It's not only reassuring to see your guys' commitment but also a pleasure to be able to communicate so directly.

Regarding the SWF limitation, I guess most mobile development now is cross-platform so developers most probably have already worked around the issue for iOS and probably won't have any issue adapting.

I didn't know about the 4 CPU architectures... eager to hear back regarding feasability :)

leossmith commented 4 years ago

Hey @ajwfrost , did you have any time checking if this can actual happen in the future?

ajwfrost commented 4 years ago

Hi - I spoke with Adobe who had looked at this, I think one of the main issues is that to do this for the various platforms will complicate the build process (via ADT) as well as the runtime, and add the restrictions around newly loaded code. Currently when you open a SWF you get the ActionScript put through a just-in-time compiler to convert it to machine code, and this doesn't actually take a huge amount of time. So the expected effort to do this may not have much of a pay-off in terms of the performance gain. We'd still have all the Java glue code that's sat within AIR on Android and is probably more of a slow-down than the actual AS3 processing..

We can keep this on the wish-list but I'm not sure it would be a massive priority unless we could get some metrics showing how much faster it might be. Bear in mind that as you run your app, the AS3 will be being jit-compiled anyway, so after a minute or two of using it, the app would likely then be running as fast as if it was all aot-compiled...

thanks

leossmith commented 4 years ago

That makes total sense. If there are not performance gains from the AOT, there is no point of putting effort on that. AIR on Android felt always laggy compared to iOS, and I always thought that AOT was the main reason.

Thanks for the update.

neuronix commented 4 years ago

Thanks for the reply @ajwfrost. Makes sense indeed to drop the idea if the performance problem is elsewhere.