Add comment is slow

Hi support team,
it´s really slow to add comments to an excel cell.
The add does get slower with each new comment in the worksheet.
In the test solution a new workbook will get created.
1 shett will contain 50k comments and the other one 100k comments.
It does take about 2s to create the sheet with 50k comments and about 8s to create the sheet with 100k comments.
AsposeTestApp.zip (5.9 MB)

Could you please have a look.
Thanks

@kriki,

I think it is normal. When you add so many comments (e.g., 50k or 100k comments), surely, it will take time to add comments and then save the file. If you could open the output Excel file (having so many comments in it) into MS Excel manually, MS Excel will also take time to open into it.

Anyways, as per your requirements, we will check if we could enhance the speed for adding comments a bit. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-55292

Once we have an update on it, we will let you know.

@kriki

When adding one Comment, we need to calculate its position and size to get the same behavior with ms excel. This is time-consuming process. If you do not change any row height and column width while adding comments, you may use the cache mechanism( Worksheet.StartAccessCache(AccessCacheOptions)) to accelerate the process:

            Worksheet ws = wb.Worksheets[0];
            CommentCollection comments = ws.Comments;
            wb.StartAccessCache(AccessCacheOptions.PositionAndSize); //cache position related data for read-only access
...
            long comments100k = sw.ElapsedMilliseconds;
            ws.CloseAccessCache(AccessCacheOptions.PositionAndSize); //close the cache to recover normal access to the data model

            ws = wb.Worksheets.Add("test2");
            comments = ws.Comments;
            ws.StartAccessCache(AccessCacheOptions.PositionAndSize);
...
            long comments50k = sw.ElapsedMilliseconds;
            ws.CloseAccessCache(AccessCacheOptions.PositionAndSize);

Thanks that really speeds up the addition of comments.

@kriki,

That is great. We’re happy the suggested cache mechanism improves performance.