Open itlancer opened 5 years ago
Found this curious as the code that does the formatting is platform-independent - but uses a third party library. We'll do some extra profiling and see whether we can speed this up on Android..
Looked into this a little more, the code does end up calling back into the Android Java layer to do the work, but there are some inefficiencies in here so we should be able to optimise this a bit..
This issue still exists with latest AIR 33.1.1.50.
Problem Description
Format Date via
DateTimeFormatter.format
method has extremely low performance. Each method call takes about 5 ms with mass market tablets, phones and TV boxes. With this issue DateTimeFormatter.format method completely unusable with low-end Android devices. We need to show date and time fields in our multi language application, but if we use this method application frame rate down to 5-10 FPS with some devices.It has been tested with many different AIR versions even with latests AIR 32.0.0.144 beta and AIR 33.0.1.228 with different Android, iOS, macOS devices with different OSes versions an different architectures. Same problem in all cases. armv8 Android apps builds have better performance than armv7 with such cases. That works fine with Windows.
Tracker issue: https://tracker.adobe.com/#/view/AIR-3984753
Steps to Reproduce
Try to format Date object via DateTimeFormatter.format method. Application example call "format" method every frame and trace and display execution time at top-left corner of application. Application example with sources attached. date_time_formatter_performance_bug.zip
Actual Result: DateTimeFormatter.format takes about 2 ms with hight-end devices (Android, iOS, macOS) and about 5-8 ms with low-end devices that cause performance lags and FPS drops.
Expected Result:
DateTimeFormatter.format
should has better performance and takes about 0-1 ms as with Windows devices.Known Workarounds
none