jsmorley wrote: ↑March 10th, 2019, 5:17 pm
I would point out that regular expression can be VERY expensive on a long string if it isn't carefully optimized.
Yeah, I got that since you told me the first time. But the thing is, there's no regexp action happening when the CPU gets to 13%, in fact, no action at all bar the animation - and this is precisely the thing that's confusing me. Even with the animation paused, the CPU stays at 6%, which is curious, to say the least, since everything in the skin is on "stand-by" in that moment. The sliding string isn't long either (which would be a valid cause of increased CPU usage), so, at this moment, the real cause for this eludes me...
jsmorley wrote: ↑March 10th, 2019, 5:25 pm
What I'm getting at with that is two-fold.
1) If you have a RegExpSubstitute on a String measure that is thousands of lines and 10's of thousands of characters long, each of the separate Substitute components will do a search and replace in the entire string for each component of the Substitute.
2) A poorly constructed regular expression can easily cause tons of "backtracking" through the string in order to resolve all the conditions. I'm no expert in regular expression for sure, but I have seen discussions about this that can get pretty scary on a really long chunk of text.
This is my custom "debug output" of what I get in my skin (don't worry, it's not a skin, but the processed output itself). The FeedAggregator variable is the whole aggregator, and the variables starting with FeedInfoEntry at the end are the ones I'm actually displaying or using one way or another. As you can see, it's not
that long, IMHO (had to add .txt at the end of it to be accepted as an attachement here):
Feed Aggregator.inc.txt
And this is the regex I'm using to "extract" a single FeedInfoEntry entity (which I then split up to the rest of the variables at the end of the attached file):
Code: Select all
RegExpSubstitute=1
Substitute="(?siU)^(?:.*<0f>.*</0f>){0,#FeedURLIndex#}+(.*?)$":"\1","(?siU)(?<=</0f>).*?":"","(?siU)^(.*<0f>.*(?=<0e>))(?:.*<0e>.*</0e>){0,#FeedEntryIndex#}+(.*?)$":"\1\2","(?siU)(?<=</0e>).*?":"","(?:^\\1|\\2$)":""
It's basically removing the unneeded content and keeps only the "item" I'm on, based on FeedURLIndex and FeedEntryIndex. This doesn't look overkill to me, but maybe I'm wrong. Anyway, like I said, the CPU stays at 13% even after the substitute did its job. Again, this is the thing that's confusing me, because logically, this has nothing to do with animation, regex parsing, etc. ... because it happens even when those are not "active" or "working" anymore.
You do not have the required permissions to view the files attached to this post.