> Le 6 janv. 2020 à 05:09, Mitchell Shiller via 4D_Tech <[email protected]> 
> a écrit :
> 
> Hi,
> 
> I have large string arrays (about 200 k elements).
> I need to write and read them to disk.
> Speed is the most important criteria.
> 
> Options
> 1) Create a text variable (loop with CR delimiter) and then TEXT TO DOCUMENT. 
> 2) VARIABLE TO BLOB, COMPRESS BLOB, BLOB TO DOCUMENT
> 3) OB SET ARRAY, JSON STRINGIFY, TEXT TO DOCUMENT 
> 
> Obviously using the reverse commands to read from disk.
> Option one seems by far the slowest.
> 
> Anyone know if 2 or 3 is faster?
> Does the COMPRESS BLOB help? The resultant file is about 2 MB in size without 
> compression.
> If yes to COMPRESS BLOB , Any différence from native 4D vs. GZIP compression?

Hi Mitch, 
if you're in a version before v17, see this:
<https://forums.4d.com/Post/FR/15873353/2/28881754#17457534>
it's blob based. 

But since v17, using the 'join' member function seems to be far better (see at 
the bottom of the same thread), schematically:
 array to collection($item_c;$array)
 $out_t:=$item_c.join("\r")

Or better, replace the array with a collection in the whole method:
 c_collection($item_c) 
 $item_c:=new collection
 loop(...)
   $item_c.push($value)
 end loop 

-- 
Arnaud de Montard 




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

Reply via email to