Report performance on android

I'm using Xmarin.Forms app to generate report with multiple charts.
On UWP I don't have any issue, but on android it take around 2 minutes per chart.
Without chart report takes around 20 seconds.

Hi,
In what device are you getting those results? Many Android devices an be a little underpowered (and if you are using the emulator I would indeed expect to take ages because anything takes ages in the emulator). But 20 seconds seems slow (unless the file is really complex), and 2 minutes is indeed way too slow. Rendering a chart can be a little complex, and it has a lot of calls into the graphic engine, but other than that is normal code and the same code that runs in Windows or UWP.

Maybe if you can send me an example file to adrian@tmssoftware.com I can review it here.

We are running custom device

CPU: 4 x Cortex-A53 @ 1.8 GHz
GPU: 1 x GCNanoUltra 3D (1 shader) OpenGLĀ® ES 2.0, 1x GC328 2D
RAM: 2 GB DDR4

Reports have about 50 text placeholders, table with 5-6 rows and 6 or 7 charts(depends on data).
We do have some complexity as we have conditional section, we do preprocess. There are 15 name ranges, mostly KEEPROWS
On UWP it take about 15-20 second to get report, and that is ok for us. But android is way too long.

I am not really sure on what to suggest here. In my tests here, reports run reasonably fast in the android phones I tested, but of course, I can't test your particular device.

But also, I am not sure on why a chart would slow down a report generation. I originally thought it was about rendering those charts to pdf, but for reporting those charts don't really do anything. The only thing we do is to update the range of cells when we insert some, but on the rest we just load the charts and save them back unchanged. My guess is that parsing and loading the charts is maybe the slow part? But I can't say much without a way to reproduce it.

Hi,

Can you please send us your referent sample app? The app you used for testing the performances.
Also, can you provide us with exact android device you use and generation time you measure on the device?
We would like to compare it with performances we measure on our device.

If it works fine, next step would be that we create a sample app with reports we need, so you can take a look at it and hopefully give us some advice.

Thanks

Hi,
I tried here with a Nokia 6.1 from 2018:

running Android 10.
The emulator is for Android 9.

The app I used is part of the test suite and makes many calls to internal benchmarking stuff so it is a little difficult to isolate, but you can try with the demo:

https://doc.tmssoftware.com/flexcel/net/samples/csharp/android/langwars/index.html
I made some changes as to measure the time. Added a stopwatch into the

         long CreateReport(bool Offline)
        {
            var Langs = Offline? LoadData(): FetchData();

            var sw = new Stopwatch();
            sw.Start();
            var xls = RunReport(Langs);
            if (TempXlsPath != null) xls.Save(TempXlsPath); //we save it to share it and to display it on startup.
            sw.Stop();
            GenerateHTML(xls);
            return sw.ElapsedMilliseconds;
        }

and in TryCreateReport:

         long CreateReport(bool Offline)
        {
            var Langs = Offline? LoadData(): FetchData();

            var sw = new Stopwatch();
            sw.Start();
            var xls = RunReport(Langs);
            if (TempXlsPath != null) xls.Save(TempXlsPath); //we save it to share it and to display it on startup.
            sw.Stop();
            GenerateHTML(xls);
            return sw.ElapsedMilliseconds;
        }

For completeness, there was a change (again) in the permissions API of android, and to show the app in the android 10 device, I had also to add this 2 lines (which will be added to the demo in the next release):

        void LoadHTML()
        {
            ResultsWindow.Settings.AllowContentAccess = true;
            ResultsWindow.Settings.AllowFileAccess = true;
            if (!HTMLLoaded)

The results I get for the unmodified app are:
First run: 3s (I guess there is some AOT going on, this was also with a debug release)
Next runs: around 30ms

For the emulator:
First run: 4s
Next runs: around 10ms.

Note that the time you see on screen includes the time to render the file to html and display it in the browsers. But the stopwatch measures only the report generation phase.

Then I tried changing the template and output files to xlsx (since xlsx is slower than xls) and copied the chart 4 more time to have a total of 5 charts.
The numbers are now:
First Run: 4s
Next runs: Around 100ms.

In the emulator:
First Run: 5s
Next runs: around 50ms

Hi, thanks for the sample.

What is recommended way for specifying "open" range for a column? I think the export is slow on our side because the current template specifies the entire columns ( for example "=RunData!$A:$B").
If I try to limit to just "=RunData!$A$1:$B$50" it is much faster.
So, is there a way to specify the whole column range, but not to include empty rows?
Or should we define ranges programmatically based on number of records that we really have runtime?
Do you have any suggestion how specify a range which contains all non empty cells in a column?

Thanks

Hi,
Is "=RunData!$A:$B" a range of a series of the chart, or part of a formula?
If in the chart, you should just specify the rows that you use, not the full column. As in the example I mentioned: You specify rows 1 and 2 of the chart, the others will be inserted when you insert the data.

If "=RunData!$A:$B" is part of a formula, then it probably is using an array formula somewhere. I would need to see the formula more in detail to say more.

Hi,

That was the problem. Selecting just two rows in range makes it run much faster.
Thanks for your support.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.