codebytere / codebytere/node-mac-contacts
Slow performance with lots of contacts
- Dominant language
- Objective-C++
- Stars
- 86
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.