×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    23

    Issue with slow date operations on N95

    I've pinned down a performance and crash problem on the N95 to this sequence of code. I need the date and time in this exact format: "YYYY-MM-DD HH:MM:SS", and what follows is the way I solved it. Please indicate if I'm doing something fundamentally wrong in achieving what I intend. Even so, it shouldn't bog down the CPU.

    pTimeBase controls whether time info should be taken from the phone or a pre-set time value (from GPS). As the issues occur also when the date variable is used, it's not "new Date()" that's the problem, but rather the Calendar related methods. This occurs on no other phone I've tested with, including 6630 that's also Series 60 but much older.

    Date actualDate = (pTimeBase == TBPHONE || !active) ? new Date() : date;
    Calendar cal = Calendar.getInstance();
    cal.setTime(actualDate);
    return (
    "20" + valStr(cal.get(Calendar.YEAR)) + datedel +
    valStr(cal.get(Calendar.MONTH) - Calendar.JANUARY + 1) + datedel +
    valStr(cal.get(Calendar.DAY_OF_MONTH)) + " " +
    valStr(cal.get(Calendar.HOUR_OF_DAY)) + timedel +
    valStr(cal.get(Calendar.MINUTE)) + timedel +
    valStr(cal.get(Calendar.SECOND))
    );

    valStr:

    private String valStr(int val)
    {
    if (val <= 0 || val >= 100)
    return "00";
    else if (val < 10)
    return "0" + Integer.toString(val);
    else
    return Integer.toString(val);
    }

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    23

    Re: Issue with slow date operations on N95

    This is clearly a bug in the N95. For some reason reading out date/time takes several seconds and slows the application to a crawl.

    Anyone found a workaround?

  3. #3
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Issue with slow date operations on N95

    interesting, needs to be investigated. I'll get back to you on this.

    Hartti

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Issue with slow date operations on N95

    I quickly created a test midlet based on your code with measuring the time used for each of the steps (the only difference is that I did not create the formatted date in the return-clause so I could also measure how long the formatting took). I tested with 5700 XpressMusic (as I do not have N95 at my hands right now)

    creating the Date took around 400 ms
    creating the Calendar took around 250 ms
    setting the date took around 30 ms
    formatting the date took around 50 ms


    What is the firmware version of your phone?
    Are these numbers something you see on N95?

    Hartti

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Issue with slow date operations on N95

    And ran the test again with colleagues N95. Unfortunately I cannot confirm your findings
    ~300
    ~70
    ~40
    ~50

    Does not look too bad. Also I did not see any crashes.

    The firmware version on this phone is 11.0.026

    Hartti

  6. #6
    Registered User
    Join Date
    Jan 2006
    Posts
    23

    Re: Issue with slow date operations on N95

    Actually you confirm my findings, as I also do a lot of other processing (sometimes 100s of floating point operations, sorting of arrays etc), and this is the straw that breaks the camel's back.

    The times you list are very long, and I need to read and format the time every second.

    On other phones, e.g. Sony Ericsson's and including much less powerful ones, these operations are much quicker and don't affect other threads. On the N95 other threads seem to halt while these operations are performed.

    Why do you consider these times acceptable, and why should reading out the date take 300 ms? It doesn't "do" anything except creating a small object to put the current date in. Can't take many milliseconds, if even that.

    I guess I need to read out the current time in a more efficient manner. The question is how.

    I'll return with the version number. Don't know how that's done at the moment.



    Quote Originally Posted by hartti
    And ran the test again with colleagues N95. Unfortunately I cannot confirm your findings
    ~300
    ~70
    ~40
    ~50

    Does not look too bad. Also I did not see any crashes.

    The firmware version on this phone is 11.0.026

    Hartti

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    23

    Re: Issue with slow date operations on N95

    By the way, I tested the exact same application on Nokia 6630, and I don't notice any lags there, at all. The only difference is that I of course don't access GPS via Location API on the 6630, but rather via Bluetooth.

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: Issue with slow date operations on N95

    I have exactly the same problem with my personal finance application JabpLite, which makes extensive use of java.util.Calendar. The application runs well on a wide range of devices, including S60 3rd edition. But on the N95, users report that the performance is very poor with simple tasks taking extended times. I'm pretty sure that this is related to the above bug.

    Best regards,
    Malcolm
    www.freepoc.org

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    Re: Issue with slow date operations on N95

    I would also like to confirm this finding. We have an app that runs quite nicely on many phones, including Nokia S40 and S60 phones. But on the 5700 (haven't checked the N95) I confirmed that the same Calendar code listed above is bringing a simple list repaint operation to a crawl. We just updated the firmware to the latest last week.

Similar Threads

  1. preverify error. PLZ HELP
    By michaelhann89 in forum Mobile Java Tools & SDKs
    Replies: 14
    Last Post: 2007-03-22, 22:51
  2. N95 release date in the US?
    By warped.reality in forum General Development Questions
    Replies: 2
    Last Post: 2007-01-24, 09:03
  3. RTSP video streaming issue on 6280
    By olivier_irac in forum General Development Questions
    Replies: 0
    Last Post: 2006-12-04, 15:11
  4. Replies: 5
    Last Post: 2006-04-12, 22:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×