codebytere / codebytere/node-mac-contacts

Slow performance with lots of contacts

オープン
#10 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
performance
主要言語
Objective-C++
スター
86
フォーク
18
PR マージ指標
30日以内にマージされた PR はありません

説明

Since my app was being very slow on their computer (MBP 16" 2019), I got a friend to run this:

```js
const nmc = require('node-mac-contacts')
console.time('done')
const c = nmc.getAllContacts(['contactImage', 'contactThumbnailImage', 'jobTitle', 'departmentName', 'organizationName', 'middleName', 'note', 'socialProfiles'])
console.log(c.length, 'contacts')
console.timeEnd('done')
```

It took 16s for ~4k contacts.

> 3705 contacts
> done: 16798.31201171875ms

Thought it might be the image buffers so asked them to run:
```js
console.time('done')
console.log(require('node-mac-contacts').getAllContacts().length, 'contacts')
console.timeEnd('done')
```

It still took 12s.

Any ideas on how to make it faster or debug this? I created 4k contacts with a first and last name on my Mac but it didn't slow it up much:

> 4135 contacts
> done: 319.488037109375ms

I'll use a worker and cache the results as a workaround. I'm curious why it takes so long.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、macOS で報告されている getAllContacts のベンチマークを、記載されている連絡先フィールドの有無それぞれで再現し、16 秒の場合と 319 ms の場合を比較します。node-mac-contacts の実装を追跡して、似たような連絡先数でなぜこれほど大きな差が生じるのかを特定します。原因を理解し、測定可能なパフォーマンス改善または明確な制限を文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
macos, node.js, objective-c
領域
desktop, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。