BlackBerry PIM is why so slow contact is created?

The following code, I got the blackberry Forum, takes almost 26 minutes to create 2000 random contacts using the PIM API of BB on one set of 8500 series. Does anyone have an idea why it takes so long or how to improve the performance of creation of contact in the address book?

HM... 26 minutes for 2000 contacts means ms 780 by a contact.

(1) you can check contact.commit (); is not the call much more time here? You could do that relatively accurate with sth like this:

long timeSpentOnCommits; defined somewhere at a higher level
...
Start long = System.currentTimeMillis ();
contact.Commit ();
took a long time = System.currentTimeMillis () - start;
timeSpentOnCommits += taken;
...
then after that all contacts have been added, you can get
an hour of average validation:
long timePerOneCommit = timeSpentOnCommits / 2000;
Discover the obtained value in a 'dialogue' or a logging

If it takes most of the time, so I don't think you can improve it.

(2) another idea - in the loop 'for' you create too many String objects, so this forces the operating system to call the garbage collection too frequently (which is a thing of your time).

Use StringBuffer instead. So instead of the

addr [contact. ADDR_POSTALCODE] =
arrSzAlphas [generator.nextInt (arrSzAlphas.length)]
+ arrSzAlphas [generator.nextInt (arrSzAlphas.length)]
+ Integer.toString (generator.nextInt (99))
+ Integer.toString (generator.nextInt (9))
+ " "
+ arrSzAlphas [generator.nextInt (arrSzAlphas.length)]
[+ arrSzAlphas [generator.nextInt (arrSzAlphas.length)];

Use this:

addr [contact. ADDR_POSTALCODE] = new StringBuffer()
. Append (arrSzAlphas [Generator.nextInt (arrSzAlphas.Length)])
. Append (arrSzAlphas [Generator.nextInt (arrSzAlphas.Length)])
. Append (Generator.nextInt (99))
. Append (Generator.nextInt (9))
. Append(' ')
. Append (arrSzAlphas [Generator.nextInt (arrSzAlphas.Length)])
. Append (arrSzAlphas [Generator.nextInt (arrSzAlphas.Length)])
. toString();

StringBuffer.append () is too important for any primitive type, so it can accept integer (ints) and the characters directly without needing to be converted into String objects.

The same approach should be used for the generation of phone numbers.

(3) minor speed improvements could be obtained by the extraction of all repetition of the loop calls "for". For example, just count how many times you call to arrSzAlphas.length (iterations 2000 * 4 calls per iteration = 8000 times!), while you could call ONCE before the loop and store it in a visible final local variable of the loop. It is the same for a set of contacts.isSupportedXXXX calls - you must call him not included in all iterations, just call him once before the start of the loop.

Tags: BlackBerry Developers

Similar Questions

  • different types of property blackberry.pim.Contact

    The WebWorks documentation documents the categories property of an blackberry.pim.Contact to a string object:

    http://www.BlackBerry.com/developers/docs/WebWorks/API/BlackBerry.PIM.contact.html

    I actually see it as an array of strings in my tests with SDK 2.1.  The intention that it should really be a string or an array?

    Catch deedubbu,

    This is an error in the docs and must be an array of strings. Why don't you help to repair by logging into an issue on github here

  • blackberry.pim.contacts.Contact.save () does not work in the perimeter of the company

    I created a contact. Then, I saved the contact. Everything works fine in the personal area.

    var createdContact = blackberry.pim.contacts.create();
    // Adding properties here
    createdContact.save(onSaveContactSuccess, onSaveContactError);
    

    But in the perimeter of the company, I get:

    blackberry.pim.contacts.ContactError.INVALID_ARGUMENT_ERROR

    When save() is called.

    Can someone confirm this behavior?

    Well, it works today. Perhaps, allowed the restart of the unit. I will study it further.

  • 'undefined' is not an object ("new blackberry.pim.contacts" evaluation)

    Hi, I'm working on the PIM contact. I did the CPO. That works well, but when I put implement this code in my project, I am getting following error

    TypeError: 'undefined' is not an object ("new blackberry.pim.contacts" evaluation)

    He comes to
    findOptions = new blackberry.pim.contacts.ContactFindOptions ();

    I added also permission

    <>ermissions >

    <>Ermit > access_pimdomain_contactsermit >

    ermissions >

    Any help

    I have error. To add the function id in the config file.

    I forgot that part.

  • error BlackBerry.PIM.contacts.Find

    Hello

    in my application, I <> ermit > access_pimdomain_contactsermit >, that I would like to contact.

    BlackBerry.PIM.contacts.Find (contactFields, findOptions, onFindSuccess, onFindError); always makes me success call back even if I turn off my permissions of applications safety contacts and privacy-> application permissions-> my request.

    Ideally, it should go to onFindError and throwing an error: 20, permission denied.

    How to fix this, please help

    Recorded a problem in the Git hub:
    https://github.com/BlackBerry/BB10-WebWorks-framework/issues/652

  • Difference between blackberry pim and pim j2me

    is it possible that j2me pim and blackberry pim support different contact fields?

    The BlackBerryContact interface supports more fields than the Contact interface.  These additional fields are listed in the constants section of the JavaDoc for Contact BlackBerry.

    http://www.BlackBerry.com/developers/docs/6.0.0api/NET/RIM/BlackBerry/API/PDAP/BlackBerryContact.htm...

  • BlackBerry smartphones can not use the contact option search on blackberry messenger

    my camera 9360

    I can't use contact search on my blackberry messenger, if I use that just get my blackberry Messenger to block/no response.

    What will happen?

    Pliss help me, brother and sister n

    Thank before and after

    Hmm... I don't know why your BBM contacts are suspended.

    • I would try to backup your BBM contacts on your media card (open BBM > Menu key > Options > backup locally to media card).
    • Then, to delete BBM on your device in Options > advanced > Applications (options > device > Applications)
    • Perform a simple reboot on the BlackBerry this way: with smart BlackBerry poweredphone, remove the battery for a minute and then reinsert the battery to restart.
    • Now, reinstall BBM using your Blackberry browser to www.blackberry.com/bbm
    • restore your identical to the backup above BBM contacts.
  • Smartphones from blackBerry Storm 2 (9550) synchronization of Contact with the Desktop Version 5.0.1.18 and Outlook 2003

    I just took my Blackberry last week and now in train to synchronize my contacts and have problems. I put the desktop software to replace the device to Outlook. That's why destroy all contacts on the device.

    All my contacts are sorted the name, first name. By examining the details of the synchronization (before it actually applies), I see that all the contacts on the camera original should be deleted (it's good!). But I find that some of the contacts are ignored and will not be added. In addition, some family names are now given names, and vice versa. When I have a John & Cathy'sname and a surname of Jones (for example), John is added as the first name, & is added in the middle and Jones is added under the family name. Nothing after the & is ignored.

    Is there a solution to this problem of synchronization? Are there better synchronisation software out there?

    Thank you

    Dwyne

    In talking with the Blackberry expert at the local Verizon store, I find the problem and the solution in the following way:

    Using the example "John and Cathy Jones '... The sync software looks at the name of Outlook in the format of "first-name vacuum vacuum-name last-name '. So when white was found during the synchronization, it assumes the & is the name of way and he picks up the last characters to the family name. I had to fix all my names "JohnCathy Jones" or "John & Cathy Jones". Two of these formats properly synchronized. However, the synchronization software does not care what is in the field of 'Society' Outlook, all characters are synchronized.

    Problem solved.

    Dwyne

  • Support for blackBerry Smartphones BlackBerry PIM demo

    Hello team BlackBerry,

    We are working in HCL Technologies INDIA on BlackBerry Mobile Apps. We use the sample application Blackberry PIM DEMO provided by RIM with the separate package javax.microedition.PIM, so I need to know if there is support for javax. Microedition.PIM package if any pose queries when using the demo of PIM ie (javax.microedition.PIM) package.please I would like to know as it is very needed by our team to work on the PIM package.

    Please review as soon as POSSIBLE.

    Concerning

    Vinay mundrathi

    8179244050

    [email protected]

    Hello

    While its kind of you thought we might be scientists to BB, this forum is for ordinary users.

    The only contact I have is an email address [email protected]

  • Cannot update the categories for blackberry.pim.Task)

    Hello

    I'm developing an Application of tasks with Blackberry WebWorks and JavaScript for OS 5.0.0. +.

    The work of JavaScript functions fine base, I can read tasks, organize by categories, read status, uid and so on.

    Create new tasks usually works as well, but: this task which does not work is the award categories to a new or existing.

    Here is the JavaScript code that creates tasks.

    function addTask(field) {
            var newTask = new blackberry.pim.Task();
        newTask.summary = document.getElementById(field).value;
        newTask.note = document.getElementById(field).value;
        newTask.categories = "DesiredCategory";
        newTask.save();
    }
    

    As I said, the task is created, but without category (category itself is of course).

    Any ideas?

    Thanks in advance!

    Hi DerSchneider,

    There is a bug in our docs, categories must be an array of strings. I've updated this issue in GitHub https://github.com/blackberry/WebWorks-API-Docs/issues/223 accordingly

    The following simple change should fix.

    newTask.categories = ["DesiredCategory"];
    
  • BlackBerry Smartphones changing "synchronize using" for contacts

    I used to use BES, but now I'm on BIS.

    I want to synchronize my contacts with Google Apps / Gmail, but all my existing contacts say "synchronize using the: Desktop", while the new contacts I create say "using synchronization: [email protected]". "

    How can I move my contacts from Gmail?

    Thank you

    Weird. I thought I posted a follow-up. I wanted to move the contacts you want to synchronize with my Gmail / Google Apps account here, that's how I got it working:

    Download the free "ABC Amber Blackberry Editor" (not to be confused with ABC Amber Blackberry Converter, I paid $19.95 for which it did not help) among Free Download ABC Amber BlackBerry Editor, edit contacts in IPD files.

    Create a backup of your contacts via Blackberry Desktop Manager.

    Create a new backup (via the backup and restore-> advanced) only on the "Address Book - All" database, and save this as a separate file, IPD.

    Clear (empty) both the 'address book' and the 'address book' all databases.

    ABC Amber Blackberry Converter, open the second IPD file and save it as an IPD file another (in hindsight, I wonder if this step is not necessary).

    Use the Fund Manager to restore from that IPD file. All contacts are now under the BIS address.

    The strange thing is though (nothing to do with my previous question), if I edit a Contact in Google Apps / GMAIL, address, city, State and zip all move in the field "address" in my BB contacts application (all on one line). I can change it back to normal (i.e. address, city, State and zip in their individual fields) on my BB, but the next time I have edit the contact in Google Apps, it goes back on a single line.

    (I BIS contact SYNC, don't use BES).

  • Why should I contact support to cancel unused licenses in my team?

    Why should I contact support to cancel unused licenses in my team?

    Maybe it's because adobe is not a configuration of automated system to do.  or perhaps there is another reason.

  • Why so slow and fat out put for only the clip size small 1 sec?

    Why so slow and fat out put for only the clip size small 1 sec?

    Hello

    I just apply simple ray tracing 3d in AE and then try to make it by media encoder

    Meia encoder says 4 hours so he could make

    my clip was 15 sec not hd (I do not change all of the settings in media encoder to make)

    then I cut it to 1 sec encoder media took 20 minutes to make

    out put

    4.12 MB

    .avi file

    1 sec

    Why what is happening

    This only happens when I apply ray trace 3d not for others

    Thank you

    As they say - "a picture is worth a thousand words" thus:

    This is a screenshot of the small video clip (full HD) with curvature layer with RayTracing (see render estimated times):

    And the same video clip with 3D classic (without RayTracing) and effect of Warp Mesh (rendering was so fast that he even showed no estimated time - but you can see the final rendering time):

    So you almost 1, 5 h with RayTracing vs 11 dry without.

  • Why the temporary files are created?

    Original title: temporary files

    Hi, I searched the Web for a long time to know "why the temporary files are created?"
    what I understand so far is there are temporary files created by MS WINDOWS, and others created by other applications like MS OFFICE APPS? RIGHT?

    - and understand that they are created for purposes of backup in the case of MS OFFICE applications,- and I do not know how? they are created when the App crash or every few minutes or what?

    - and I do not understand why "windows Temp files are created?"

    Show me examples please.

    Thank you

    Hello

    There are many reasons why temporary files may need to be created.

    Windows temporary files
    https://support.Microsoft.com/en-us/KB/92635/

    Wiki - temporary file
    http://en.Wikipedia.org/wiki/Temporary_file

    Wiki - temporary Internet files
    http://en.Wikipedia.org/wiki/Temporary_Internet_Files

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" experience :="" bicycle="" -="" mark="" twain="" said="" it="">

  • What is the difference between vmware.log vmware - 1.log, vmware - 2.log... Why are there different logs created

    Experts of HI, need some advice what is the difference between vmware.log vmware - 1.log, vmware - 2.log... Why are there different logs created. I understand the vmware.log is to check when the VM not suite or something, but not sure the rest feed files. Thank you

    Log files are rotated once a virtual computer is turned on or when the file reaches a certain size. The vmware.log (without number) is the current log file. By default, the old files are kept for purposes of troubleshooting. You can - even if I do not - recommend disable this behavior, or even configure the virtual machine to do not create the log files at all.

    André

    PS: I forgot to attach the KB article: http://kb.vmware.com/kb/8182749

Maybe you are looking for