×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    24

    [DB] Performance problem

    I have two midlet..
    the first one (A) contains shared database (abot 400 record, each record 6 fields)

    The second midlet (B) is the real application, and use A as database

    In B i have a form like agenda, where as soon as i type a char, a list of record is updated.
    The problem is this:
    - Type 'S' [the list is updating...]
    - Type 'P' [the previus list is not ended..so wait...]
    - Type 'A' [...wait for end the previus..]
    and so on...

    This is my code:

    SearchFilter search = new SearchFilter(food, 2);
    RecordEnumeration re = locationA.enumerate(search, null, false);
    String tmp = null;
    while (re.hasNextElement()) {
    rid = re.nextRecordId();
    url = locationA.getURL(rid, true);
    // put values in vector RESULT
    }
    ...
    ...
    }


    In class SearchFilter:
    public boolean matches(byte[] candidate)
    {
    String str = null;

    try
    {
    strmBytes = new ByteArrayInputStream(candidate);
    strmDataType = new DataInputStream(strmBytes);
    str = strmDataType.readUTF().toLowerCase();
    }
    catch (Exception e)
    {
    return false;
    }

    // Look for a match
    if (str != null && str.startsWith(searchText) ){
    return true;
    }
    else
    return false;
    }

    ---------

    When i type a new char:
    public void itemStateChanged(Item item) {
    ...
    update list, using vector RESULT
    ...
    }

    --------
    Can anyone help me?
    Thanks a lot
    Matteo

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Hi Matteo!

    I'm not sure I understand what the problem is... do you mean the execution is very poor?

    Execution speed of RMS can relate more to the number of records than the amount of data.

    For example, rather than storing 400 separate records, store all your data in one large record, and load it into memory to process it there. Rewrite it back to RMS in one large chunk when the in-memory copy changes.

    Graham.

Posting Permissions

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