Skip to content

Slow performance with lots of contacts #10

@KishanBagaria

Description

@KishanBagaria

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

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions