microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
184 stars 54 forks source link

regular expressions take up too much time #576

Open SeasClouds opened 3 months ago

SeasClouds commented 3 months ago

Regular expression processing takes up a total of 80% of the time during preprocessing

  preprocessTasks.push(function (): void {
    regexp = /.*\$\(.*/gm;
    preprocessedDryRunOutputStr = preprocessedDryRunOutputStr.replace(
       regexp,
       ""
    );
  });

Do a check before using regular expressions,Does that leave anything out?

  preprocessTasks.push(function (): void {
    regexp = /.*\$\(.*/gm;
    if (preprocessedDryRunOutputStr.indexOf('$(') >= 0) 
      preprocessedDryRunOutputStr = preprocessedDryRunOutputStr.replace(
        regexp,
        ""
      );
  });
Yingzi1234 commented 3 months ago

@gcampbell-msft We have removed the "Triage" label, but according to the information provided by the user, we are not able to perform the next step of "Triage", could you take a look at it for us? Thanks!

gcampbell-msft commented 3 months ago

@SeasClouds Is this a suggestion you're making? I'm not sure I fully understand this issue, could you provide more information and context?

SeasClouds commented 3 months ago

Yes, it's a suggestion , when there is no "$(", regular matching can be skipped In my project, this step of regular matching did not find any data, but it took me 80% (2 minutes) of my time, which I cannot accept. Or match to "$(" faster to reduce the required time

gcampbell-msft commented 3 months ago

@SeasClouds Ah, understood. We'd be happy to consider taking an open source contribution for this! Would you be willing to make a PR?

SeasClouds commented 3 months ago

@gcampbell-msft I am happy to contribute to open source. I will submit a PR in my free time, but I don't think it's a good solution as it still takes up a lot of time when encountering "$("

gcampbell-msft commented 3 months ago

@SeasClouds I understand that you're still requesting a perf improvement for the regex, but if this at least improves the non regex case, then I think it's worth contributing.