Large Table building performance in v2.4
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- performance
Research direction
Start at Paragraph.Append and trace UpdateParagraphIndexesAndCurrentParagraphEndIndex into Document.UpdateParagraphIndexes, then compare the _preventUpdateParagraphIndexes handling in the ReplaceText methods. Reproduce the slowdown while appending cell text to a large table and determine whether a supported temporary indexing control is feasible; done means the v2.4 workload no longer regresses without breaking index updates.
Written by the indexing model from the issue text.
Description
Hello,
I have been using this tool to generate large report documents (over 100 pages) that contain many large tables with data in them. This has worked until I recently attempted to upgrade from v2.3 to v2.4, and the time to generate these documents has dramatically increased to the point of rendering it unusable.
After investigating, I found that the time increases are all within rows that add the text to each cell, like this:
tbl.Rows[row].Cells[col].Paragraphs[0].Append(valueForCell);
If I remove or comment out these rows the document generation time is comparable to beforehand.
Looking at the changes since v2.3 in that function I see the new call to UpdateParagraphIndexesAndCurrentParagraphEndIndex:
public Paragraph Append( string text )
{
var newRuns = HelperFunctions.FormatInput( text, null );
this.Xml.Add( newRuns );
_runs = this.Xml.Elements( XName.Get( "r", Document.w.NamespaceName ) ).Reverse().Take( newRuns.Count() ).ToList();
this.UpdateParagraphIndexesAndCurrentParagraphEndIndex();
return this;
}
which in turn calls:
this.Document.UpdateParagraphIndexes();
This new feature is not very performant when it comes to inserting data cell by cell into many larger tables. This appears to be already recognised somewhat as the Container function which has a way of internally disabling it via an internal member _preventUpdateParagraphIndexes:
internal void UpdateParagraphIndexes()
{
if( this.Document._preventUpdateParagraphIndexes )
return;
this internal member is used in a number of the ReplaceText methods to temporarily disable it.
Is there a way for us to disable this indexing feature temporarily ourselves until the entire table is built? If not, is this something that could be added in v2.5, as 2.4 is pretty much unusable at present?
- Dominant language
- C#
- Stars
- 1.9k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xceedsoftware/DocX
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
xceedsoftware/DocX#489 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
xceedsoftware/DocX#488 · 1 comment · 1 reaction ·
-
keep format Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
xceedsoftware/DocX#487 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
xceedsoftware/DocX#485 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
xceedsoftware/DocX#482 · 4 comments ·
All issues in xceedsoftware/DocX
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·