We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Significant decrease of performance (getting bookmark) again

Hi Aspose Team,

Getting bookmark became work very slow.

There is an issue in Aspose 18.3 - 18.7.
Aspose 18.1 works fine.

For example;
bookmarks count - time

18.1:
1000 - 00:00:00.4244833

18.7:
1000 - 00:01:07.7101032

Source code:

var document = new Document();

  	var builder = new DocumentBuilder(document);

  	for (var i = 0; i < 1000; i++)
  	{
  		builder.StartBookmark(i.ToString());
  		builder.Write(i + ": AAAAAAA");
  		builder.EndBookmark(i.ToString());
  		builder.Writeln();
  	}
  	
  	var bookmarkNameList = new List<string>();

  	var sw = new Stopwatch();
  	sw.Start();

  	for (var i = 0; i < 1000; i++)
  	{
  		bookmarkNameList.Add(document.Range.Bookmarks[i.ToString()].Name);

  		builder.StartBookmark(i + "_2");
  		builder.Write(i +  "_2" +": AAA");
  		builder.EndBookmark(i + "_2");
  		builder.Writeln();
  	}

  	sw.Stop();

  	builder.MoveToDocumentStart();
  	builder.Writeln(bookmarkNameList.Count.ToString());
  	builder.Writeln(sw.Elapsed.ToString());

  	document.Save("C:\\test.docx", SaveFormat.Docx);

Could you please take a look at this issue?

Thank you in advance.

@spectr100,

Thanks for your inquiry. We have tested the scenario and have not found the shared issue. Please check the attached output documents.
Docs.zip (20.4 KB)

Please check 18.1 version.
It is works 0.5 second.

18.3 - 18.7 version is works near 1 minute, 120 times longer.

@spectr100,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17127. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17127) have been fixed in this Aspose.Words for .NET 18.9 update and this Aspose.Words for Java 18.9 update.