OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
674 stars 95 forks source link

[Word API 1.7] (Critique API) MacOS: Annotation insertion takes too long compared to web and desktop platforms #4973

Open hannaDefinely opened 4 days ago

hannaDefinely commented 4 days ago

paragraph.insertAnnotations(annotationSet) I use this logic. This operation takes many times longer on the Mac than on other platforms. Considering that I have to go through all the paragraphs of the document and insert annotations in them, this logic can take more than a minute, depending on the size of the document. For other platforms, such as Web and Desktop, the execution time for this function is 3 times or more faster.

Your Environment

Expected behavior

Running the logic takes about the same amount of time for the Mac platform as it does for the rest of the platform.

Current behavior

paragraph.insertAnnotations(annotationSet) I use this logic. This operation takes many times longer on the Mac than on other platforms. Considering that I have to go through all the paragraphs of the document and insert annotations in them, this logic can take more than a minute, depending on the size of the document. For other platforms, such as Web and Desktop, the execution time for this function is 3 times or more faster.

Steps to reproduce

Context

This issue is preventing us from moving forward with development for the Mac platform. We have many customers who are interested in this functionality on the Mac. We would greatly appreciate your investigation into this issue.

microsoft-github-policy-service[bot] commented 4 days ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

qinliuMSFT commented 2 days ago

Hi @hannaDefinely , thanks for reporting this issue. I tested calling paragraph.insertAnnotations 20 times on win32/Mac/Word Online, and it took less than a minute on all of those platforms. No noticeable slowdown on Mac.

Here is my test environment: Mac Word version: 16.91(24100923) Win32 Word version: Version 2410 Build 16.0.18129.20040) 64-bit Word Online version: 20241014.5

My code snippet contains:

  1. Clears the document body and inserts 20 paragraphs of text. Each paragraph contains a long string of text, which will likely span around 20 pages in total.
  2. A loop iterates through the 20 paragraphs and inserts the annotation set into each paragraph. Logs the start and end times of the operation.

Could you please help confirm if my test steps are inconsistent with yours? Being able to repro will help our team solve the problem faster.