Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow perfornmance #80

Open
dpdragnev opened this issue Nov 22, 2019 · 3 comments
Open

Slow perfornmance #80

dpdragnev opened this issue Nov 22, 2019 · 3 comments

Comments

@dpdragnev
Copy link

I am using a physical android device (Node 9) to test. The NS version is 6.2.1.

When I load the contacts it takes over 30 seconds to load 827 contacts. Is this normal? Is there a way to speed things up?

Here is my code:

function getContacts() {
    //get the contacts
    console.log('start', new Date());
    var contactFields = ["name", "phoneNumbers"];
    contacts.getAllContacts(contactFields).then(
        function (args) {
            console.log('end', new Date());
        },
        function (err) {
            console.log("Error: " + err);
        }
    );
}

Here is my package.json:

{
  "nativescript": {
    "id": "io.company.app",
    "tns-android": {
      "version": "6.2.0"
    }
  },
  "main": "app.js",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@nstudio/nativescript-camera-plus": "3.0.5",
    "@nstudio/nativescript-loading-indicator": "^1.0.0",
    "nativescript-contacts": "^1.6.2",
    "nativescript-fonticon": "^2.0.0",
    "nativescript-masked-text-field": "4.0.3",
    "nativescript-permissions": "^1.3.8",
    "nativescript-theme-core": "2.0.5",
    "nativescript-ui-listview": "^8.0.1",
    "tns-core-modules": "6.2.1",
    "tns-platform-declarations": "6.2.1"
  },
  "devDependencies": {
    "nativescript-dev-webpack": "1.3.0",
    "typescript": "3.4.5"
  },
  "gitHead": "f28dbc60d74dd2cef4b645afd8fdd63bbb12c73e",
  "readme": "NativeScript Application"
}

Thanks

@fpaaske
Copy link

fpaaske commented May 10, 2020

We're experiencing the same issue;

Read 200 contacts on iPhone 8 takes 200 ms.
Read 50 contacts on S6 takes around 6 seconds.
Read 50 contacts on Pixel 3 takes around 2 seconds.

@fpaaske
Copy link

fpaaske commented Aug 26, 2020

@dpdragnev I found that converting photos to and from base64 string to allow transfer of data between worker and main thread is the main time consuming issue. By excluding the photo from the contactFields (and rather get that later, per contact) is much faster.

I think this is a limitation of the nativescript and workers, that all data has to be serializable to transfer between worker and main thread.

I see that you're not providing photo in your example code, but that's what I changed.

@triniwiz
Copy link

@fpaaske I have a couple Ideas how android can be improved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants