Improve performance #23

Closed
opened 2024-05-04 19:22:41 +00:00 by CTO · 2 comments
Owner

Commit log parsing takes catastrophically long amounts of time, ~9ms per commit

Commit log parsing takes catastrophically long amounts of time, ~9ms per commit
CTO added the
Kind/Enhancement
Priority
Medium
labels 2024-05-04 19:22:41 +00:00
CTO self-assigned this 2024-05-04 19:22:41 +00:00
CTO started working 2024-05-04 19:22:43 +00:00
Author
Owner

It looks like usage of git cli was the cause of performance issues

1st Snippet

      const s2 = performance.now();
      // const tag =
      // (commit.refs.match(/tag: (\S+)(?:,|$)/)?.[1] ?? lastTag) || unreleased;

      const tag =
        sort((await simpleGit().tags([`--contains=${commit.hash}`])).all)[0]! ||
        unreleased;
      const e2 = performance.now();

Output

59.42453299462795
59.47412600368261
59.67800899595022
...

2nd Snippet

      const s2 = performance.now();
      const tag =
        (commit.refs.match(/tag: (\S+)(?:,|$)/)?.[1] ?? lastTag) || unreleased;

      // const tag =
      //   sort((await simpleGit().tags([`--contains=${commit.hash}`])).all)[0]! ||
      //   unreleased;
      const e2 = performance.now();

      console.log(e2 - s2);

Output

0.03755100071430206
0.022923000156879425
0.023093000054359436
It looks like usage of git cli was the cause of performance issues ### 1st Snippet ```ts const s2 = performance.now(); // const tag = // (commit.refs.match(/tag: (\S+)(?:,|$)/)?.[1] ?? lastTag) || unreleased; const tag = sort((await simpleGit().tags([`--contains=${commit.hash}`])).all)[0]! || unreleased; const e2 = performance.now(); ``` Output ```bash 59.42453299462795 59.47412600368261 59.67800899595022 ... ``` ### 2nd Snippet ```ts const s2 = performance.now(); const tag = (commit.refs.match(/tag: (\S+)(?:,|$)/)?.[1] ?? lastTag) || unreleased; // const tag = // sort((await simpleGit().tags([`--contains=${commit.hash}`])).all)[0]! || // unreleased; const e2 = performance.now(); console.log(e2 - s2); ``` Output ```bash 0.03755100071430206 0.022923000156879425 0.023093000054359436 ```
Author
Owner

Previously: 8,374213836ms/commit
Now: 0,002939648ms/commit

2848 times faster

_Previously:_ `8,374213836ms/commit` _Now:_ `0,002939648ms/commit` **2848** times faster
CTO worked for 40 minutes 18 seconds 2024-05-04 20:03:01 +00:00
CTO closed this issue 2024-05-04 20:55:50 +00:00
Sign in to join this conversation.
No description provided.