123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|609|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Monkey -> Monkey Strings

Wed, 30 Oct 2013, 03:57
Jayenkai
This might not be interesting/useful/anything, but it's something I recently discovered..

Monkey, on certain targets, appears to behave strangely when putting together strings in certain ways.

Whether this is Monkey at fault, or the way the device handles strings, I'm not sure, but since HTML5 plays fine, but GLFW doesn't, I'm going to assume it's some sort of translation quirk..

You add two strings together by going..


If you stick it into a loop of, say 100, you get..


Next, make even more loops..



At this point, you'll notice slowdown. Nothing MASSIVE, but a good half-a-second or so.
I first noticed this when trying to cram 1000 levels worth of highscores into a giant SaveState(), which saved between levels.
.. The result wasn't pretty!!

Here's the thing, though.
I found a workaround, though, and it's baffling!




The result is the same, but the slowdown completely disappears.
Quite why this is, I'm not sure, but there you have it.
Useful/not, it's something to be aware of when handling strings.

-=-=-
''Load, Next List!''
Wed, 30 Oct 2013, 05:35
shroom_monk
Do you get identical slow-down if you have a single 10000 iteration loop instead of two nested 100 iteration ones?

It sounds like it's caused by the String type being implemented differently on different platforms, with the HTML5 implementation having more efficient concatenation for massive strings.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Sun, 03 Nov 2013, 05:02
Jayenkai
Sorry, been sidetracked, and mostly forgot about this until this morning, when I restumbled upon the same bug, and went "Oh yeah, forgot about that!!"



"Up" is slow, "Down" is incredibly slow!
An odd, but existent bug/quirk..

-=-=-
''Load, Next List!''