This project has moved. For the latest updates, please go here.

Unused code affecting performance

Aug 22, 2013 at 11:51 AM
Hello, i've started using your library and noticed that replacing text is very slow.
I started investigating this issue and noticed that in the Paragraph's constructor (lines 280-323) used the XDocument.Load() method.
XDocument style_document = XDocument.Load(tr);
After this method some code is commented, so it is not used at all.
But call of this method greatly affects performance.
Why the code below this method is commented and will it be used later?
Developer
Aug 22, 2013 at 11:53 AM
Why would a commented code affect performance ? It's not used, it's not compiled so it doesn't exists in the binary?
Aug 22, 2013 at 12:09 PM
it is used, but in fact it is not used.
XDocument style_document = XDocument.Load(tr);
XElement styles_element = style_document.Element(XName.Get("styles", DocX.w.NamespaceName));
and
styles_element
is not used.
Coordinator
Aug 22, 2013 at 1:30 PM
xfocuse you are correct. It appears that the entire #region It's possible that a Paragraph may have pStyle references
is no longer required.

Are you interested in contributing to DocX? I'm sure the community would be delighted if you profiled the code and identified areas that could be sped up. The issue you have identified above could be your first commit?


Developer
Aug 23, 2013 at 11:44 AM
Edited Aug 23, 2013 at 11:55 AM
As per your recommendation I've removed (commented out) that code from source code https://docx.codeplex.com/SourceControl/changeset/84926

Thanks. And welcome back Cathal :-)
Coordinator
Aug 23, 2013 at 9:05 PM

MadBoy, thank you for your continued support. You have kept DocX alive in my absence.

By the way, I just got into the University of California Berkeley. I'm moving to California next week to continue my PhD. I am however going to try to keep up with DocX this time. Its only recently I realised how far DocX has truly reached. It's out there in the world doing great things and this makes me very happy.

Thanks again for all your support, Cathal