Reserve xml size if available #1301

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@Karlson2k
Member

If we know the file size, then reserving the correct amount is best.

@Karlson2k Karlson2k CXBMCTinyXML: reserve string size exactly what we need
On small files this will prevent oversized allocation (and will be faster), on huge file this will prevent multiple reallocation of CStdString (and will be faster)
47ed046
@Karlson2k
Member

@jmarshallnz Rewritten.
If it's OK, I'll check other parts for double XML processing (like addons)

@jmarshallnz
Member

You can probably just remove the Loadfile in the constructor to save changing any other code?

@jmarshallnz jmarshallnz reopened this Aug 19, 2012
@Karlson2k
Member

@jmarshallnz This can break other using of CXBMCTinyXML, as code can expect that XML is already loaded and parsed if it's specified in constructor parameter.

@Karlson2k
Member

And I see a lot of using of CXBMCTinyXML.
It's created and loaded several times on every visible windows transition, so 47ed046 and using of 99acb24 is highly valuable. Other code can be modified similar to 1be538e .

@jmarshallnz
Member

A quick grep through the sources shows only 2 places using the constructor
that takes a string. In the scraper parser and in the CDVDStateSerializer.
The latter isn't being intended to load at all.

Further, before we switched from TiXmlDocument to the wrapped version all
of these would have used the base TiXmlDocument constructors which also
don't load the file.

Thus, LoadFile() should not be called in the constructor. I'll remove it
from master, thus fixing the problem.

On Mon, Aug 20, 2012 at 9:22 AM, Karlson2k notifications@github.com wrote:

And I see a lot of using of CXBMCTinyXML.
It's created and loaded several times on every visible windows transition,
so 47ed046 47ed046 and using of
99acb24 99acb24 is highly valuable.
Other code can be modified similar to 1be538ehttps://github.com/xbmc/xbmc/commit/1be538e.


Reply to this email directly or view it on GitHubhttps://github.com/xbmc/xbmc/pull/1301#issuecomment-7856981.

@jmarshallnz
Member

Updated master with a proper fix f58303b and be982ba.

Also rewrote CScraperParser::Load to use the more intuitive form in 49b7e5c

@jmarshallnz jmarshallnz reopened this Aug 20, 2012
@Karlson2k
Member

@jmarshallnz Yes, that's better way.
After your fixes there is only one commit for optimization.

@Karlson2k
Member

@jmarshallnz Was last commit wrong?

@LongChair LongChair added a commit to plexinc/plex-home-theater-public that referenced this pull request Nov 21, 2014
@LongChair LongChair Fix Go back to save viewMode per subsection #1301 eeb59f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment