SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Classic ASP - Lcase operation on array taking too long

    Hi,
    I'm working with a script designed to compare values returned from a form against values from a database dumped to an array, via GetRows.
    Currently, the code uses an inner and outer loop to run this comparison, with a temporary variable being assigned the current col/row from the

    aforementioned array. An lcase and trim operation are performed on the value to obtain the temporary variable.
    This is causing a considerable performance drain, and I was wondering if the lcase/trim functionality could perhaps be performed during the creation

    of that array, rather than in a looping situation?
    Here's my code:
    **note: this utilizes the FastString Class for concatenation, thus the "FastString" and ".Append"
    Code:
    dim iRowLoop, iColLoop, zRowLoop, strChange, tempDbValsCase
    Set strChange = New FastString
    for iRowLoop = 0 to ubound(arrDbVals, 2)
    '///response.write(""""&arrDbVals(1,iRowLoop)&""""&"<BR>")
    
    for zRowLoop = 0 to ubound(arrFormComplete)
    '///response.write(""""&arrFormComplete(zRowLoop)&""""&"<BR>")
    
    '****below line is what is causing the bottleneck, according
    '****to a timer test
    tempDbValsCase = lcase(trim(arrDbVals(1, iRowLoop)))
    '****
    
    if (mid(trim(arrFormComplete(zRowLoop)),1,8) = trim(arrDbVals(0, iRowLoop))) AND (mid(trim(arrFormComplete(zRowLoop)),9) <> tempDbValsCase)
    
    then
    
    
    dim strFormAllVals
    strFormAllVals = arrFormComplete(zRowLoop)
    strChange.Append strFormAllVals & ","
    
    end if
    
    next
    
    next




    On the database side, the table from which the array is derived through GetRows contains the bit datatype column "Complete". The lcase and trim

    operations are performed upon this column of the array. Does the bit datatype add any hidden characters in the output? Visually, I don't detect

    any, but when I compare a value of "True" from the form input against a value from the array that looks like "True," it doesn't match, until I run

    the lcase and trim on the "Complete" column.

    Thanks for any help!
    Kind Regards

  2. #2
    Non-Member
    Join Date
    Feb 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need a solution. Just mention the heading for which you are writing the code.


Tags for this Thread

Bookmarks

Posting Permissions

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