OT4XB - _HDICT_NEW()

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

OT4XB - _HDICT_NEW()

#1 Post by unixkd »

Code: Select all

static function randomtest()                                                                                                                                                                                        
local nSeconds := Seconds()  
local n, aTest[0], MAX_LOOP := 3000000                                                  
local pHt      := _HDICT_NEW(,MAX_LOOP)                                       

for n := 1 to MAX_LOOP                                                        
   _HDICT_SETPROP(pHt,cBin2Hex(cGenRndStr(8,.T.)), 0)                         
   // cBin2Hex() is needed here as the hash table is case insensitive         
next                                                                          
aadd(aTest,{" Elapsed Time: %i Seconds " , Seconds() - nSeconds})                   
aadd(aTest,{" %i Items  %i Duplicates",MAX_LOOP , MAX_LOOP - _HDICT_COUNT(pHt)} )
DC_Arrayview(aTest)                                                                 
return NIL  
This sample program gives IDSC error when the value of the MAX_LOOP is high eg 5000000

Joe

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

Re: OT4XB - _HDICT_NEW()

#2 Post by patito »

Hi

have asked Pablo and he told me that: Current versions of ot4xb hash table
using malloc/free to alloc the memory that rely on the common process heap,
this works faster that using it's own heap but reduce the number of handles
so the capacity is around the half million items.

With a custom heap the limit will be the 2GB. I was tempted lot of times
to enhance it to support a custom heap like in the _tlist_* functions,
but usually for big recordsets open sqlite ":memory:" and temporary ""
databases working so well so the feature was stucked forever
in the todo list as never needed in production scenaries

Best Regard
Héctor

Post Reply