C_OBJECT($temp)

For ($index;1;20000)

$key:="Variable_"+String($index)+"_name"

OB SET($temp;$key;"")
End for 

C_BOOLEAN($test)
C_LONGINT($start)
$start:=Milliseconds
$test:=OB Is defined($temp;"Variable_10000_name")
ALERT(String(Milliseconds-$start))  // I get 0

  //versus

ARRAY TEXT($temp_array;0)
C_LONGINT($fnd)

For ($index;1;20000)

$key:="Variable_"+String($index)+"_name"
APPEND TO ARRAY($temp_array;$key)
End for 

$start:=Milliseconds
$fnd:=Find in array($temp_array;"Variable_10000_name")
ALERT(String(Milliseconds-$start)) // I get 1

If I change the search parameter to Variable_20000_name, the array takes twice 
as long (2) and the c_object search is still 0.

This may or may not have been Justin’s point. :-)


> On Nov 9, 2016, at 1:03 PM, Mike McCall <[email protected]> wrote:
> 
> Thanks Lee,
> 
> Unfortunately, I'm not familiar with c_objects and how they might work in my 
> case. Would it be possible to give me a brief example that I could then adapt 
> and test.
> 
> Thanks again,
> 
> Mike
> 
> -----Original Message-----
> From: 4D_Tech [mailto:[email protected]] On Behalf Of Lee Hinde
> Sent: Wednesday, November 9, 2016 12:59 PM
> To: 4D iNug Technical <[email protected]>
> Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad usage 
> of pointer or pointer to an unknown variable
> 
> Justin Leavens did a summit presentation that showed c_objects were much 
> faster than arrays for searching. Might be worth a test.
> 
> On Wed, Nov 9, 2016 at 12:47 PM, Mike McCall <[email protected]>
> wrote:
> 
>> Thanks so much Chip for the suggestion,
>> 
>> That thought also crossed my mind but unfortunately with the silly 
>> number of variables we currently have, over 20,000 in total, my 
>> initial tests suggested that it could seriously affect performance to 
>> go with that approach.
>> 
>> I'd really prefer not to have to do a complete rewrite of how we 
>> handle form fields since that would be very time consuming.
>> 
>> Thanks again and definitely let me know if you or anyone else has any 
>> other idea.
>> 
>> Mike
>> 
>> -----Original Message-----
>> From: 4D_Tech [mailto:[email protected]] On Behalf Of Chip 
>> Scheide
>> Sent: Wednesday, November 9, 2016 12:38 PM
>> To: 4D iNug Technical <[email protected]>
>> Subject: Re: Automatic Variable Assignment and Web Get Variables - Bad 
>> usage of pointer or pointer to an unknown variable
>> 
>> I do NO web work so take this idea with that in mind
>> 
>> Instead of :
>> On Wed, 9 Nov 2016 19:58:16 +0000, Mike McCall wrote:
>>>      Else
>>>                              $p:=Get pointer(arr_Web_Field_Name{$i})
>>>                              $p->:=arr_Web_Field_Value{$i}
>>>              End case
>> 
>> if (find in array($arr_Legal_Variable_Names;arr_Web_Field_Name{$i})>0)
>>   $p:=Get pointer(arr_Web_Field_Name{$i})
>>   $p->:=arr_Web_Field_Value{$i}
>> else
>>   `do nasty things since someone tried to hack your server end if
>> 
>> Where arr_Legal_Variable_Names
>> is an array of valid variable names and any value NOT in this array is 
>> an error Chip
>> 
>> 
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to