very slow newText !!

Hi there,

i experienced Corona in many ways quiet fast.
But today i found out the the display.newText
is amazingly slowing down my app when I have a lot of them in a scene.

Actually i create a calendar, so for sure i have up to 31 newtext to display the
day (1-31) than another 31 new text with some additional infos in each calendar day.

on the first it does not look so slow, but while switching from one month to another,
I recognize a huge slowdown.

for example just by putting all my gfx etc in the calendar and jumping from one
month to another i could easy click ‘next month’ 10 times and it would run through the
calendar. in the moment there is text in the days. i guess the slowdown is factor 5 minimum.

at all for the enduser it looks like when he clicks ‘next month’ or ‘previous month’ the whole app
is very slow.

Is there any way to improve the speed (i guess i can’t do a lot in that) from the api display.newText?

thanks
chris

[import]uid: 4795 topic_id: 14745 reply_id: 314745[/import]

just for fun i made a test if i would implement a IMAGE instead of text.

speed is up to 4 times faster. !!! (but can’t use everywhere an image)

just as result … from my experience TEXT should be way faster than working with an image.
so the newText API could really need some improvement.

still love corona… but now i have to look how i come around that problem …
and have no idea :frowning:

chris
[import]uid: 4795 topic_id: 14745 reply_id: 54538[/import]

Hi.

Do you really need to use 30+ new texts? surely you could do it with 4 lines of text each with 7 days ? Spaced out with an offset?

[import]uid: 84637 topic_id: 14745 reply_id: 54541[/import]

i know what you mean… but that comes quiet complicated.

some days are with different color (for example TODAY) etc.
Than in each day are short excerpts from a note on that day.

so i have to trust on a fast newText rather to reinvent the wheel …

also interesting that lets say 1 round of newText (each day a month)
slow it down 50%) but another round (for each day number a shadow [different color])
keeps nearly the same speed, also my additional text in each day (excerpts) does not
slow down much more.

Whatever I do… only when i really remove every newText from each Day… the speed is good.

if does help you, i could send you my code to have a look into it.

greets
chris

[import]uid: 4795 topic_id: 14745 reply_id: 54544[/import]

are you freeing up unneeded memory [import]uid: 7911 topic_id: 14745 reply_id: 54554[/import]

for sure… i even disabled free up memory… (clean group) just to test…
and for sure it would come a bit faster even… (because saving time of cleaning up 50-60 text objects…

for now i only see a change to completely rewrite my calendar and do as ansca team mentioned.
not to put each text in a day but making it by row… also i can’t set different colors per day etc.

:frowning: i guess it will be no top priority as in a normal in game that little text is no prob.
but here with a app and a lot of text going on and than it should also switch fast as the wind from one scene to another… there you feel the limits :slight_smile:

[import]uid: 4795 topic_id: 14745 reply_id: 54556[/import]

I’ve also experienced this slowness of newText. I found that it’s the creation of the new object which takes up the most time, as opposed to the rendering of the text. So what I do is to create all the newText display objects at the start but when I go to a new screen, instead of removing them and creating new ones, I reuse the display objects but change the text within them. This reduced the time to about a quarter. In my app, I can sometimes have over 60 text display objects. Even by reusing them, it is a bit slow. If Ansca could look into optimising this, that would be great!

So for your application, you would create 31 text diaplay objects and as you change months, you would reuse those objects by changing the color of them and repositioning them for the next month. This prevents having to remove and create new text display objects.

Eric [import]uid: 29384 topic_id: 14745 reply_id: 54559[/import]

@ec2 thanks i also thought about that… will have a look into it
@ansca :slight_smile: yes please consider to have a look into it 2
[import]uid: 4795 topic_id: 14745 reply_id: 54560[/import]

Yes - object recycling was the first thing what jumped in my mind when I read the question.
Give it a try - shouldn’t be to complicated!

Good look! [import]uid: 70114 topic_id: 14745 reply_id: 54571[/import]

Try using bitmap fonts. I create 100 numbers for level buttons in my game and it’s quite fast. Amazing, considering those 100 numbers are actually about 200 sprite objects (one for each digit) and 100 groups that hold digits that comprise a number together.

You can generate bitmap fonts using this free software from AngleCode:
http://www.angelcode.com/products/bmfont/

An then load generated font using this code nicely provided by p120ph37:
https://developer.anscamobile.com/forum/2011/02/05/bitmap-font

Very easy to use and you have more control over how your fonts look like. Which is a nice thing for having sexy calendar dates, I guess :slight_smile: [import]uid: 52103 topic_id: 14745 reply_id: 54588[/import]

thanks its an option i may try.

also it would be great the standard newtext would be just faster :slight_smile:
its like shooting with bombs on flies, just because the basic bullet is to slow at all :slight_smile:

[import]uid: 4795 topic_id: 14745 reply_id: 54819[/import]

@danny

i spended one hour to test your idea… just 6 lines instead of 42 newtext.

Wohhh… on the simulator the scene switching came double fast !
BUTTT… on the device same speed AND the spaces between the days (filled with just empty spaces) was completely out of order… it looked fine on the simulator, but on the device the spaces maybe was just half size and i would had to refine completely … just by device as the simulator shows different.

and as the speed on the device is still same slow :(((( i keep my old way
and just PLEASSSSSEEEEEE speed up NewText

and as i also found out SqLite comes slow if you make a lot of request…
i just can wish you continue your PRIO with speeding up the basics, rather implementing thousand new features :slight_smile:

thx
chris
[import]uid: 4795 topic_id: 14745 reply_id: 56077[/import]