On Jan 6, 2020, at 10:50 AM, Kirk Brooks via 4D_Tech <[email protected]> 
wrote:

> I agree with Chuck here - writing a line at a time is slow. It's very
> secure though. So it's good if you may crash - whatever has already been
> written stays written to disk. But otherwise better to buffer some and then
> write.

I think that depends on whether it’s better to have partial data in the file 
than correct data. If writing partial data will cause the consumer of that text 
file to generate incorrect results or crash, then it’s better to make sure it’s 
all or nothing, typically using an atomic write mechanism like writing to a 
temp file, and when that’s completed successfully, moving the temp file to the 
destination path. 

If performance is important, concatenating text 200K times is almost definitely 
the wrong way, and the best way depends on what version of 4D you’re using, the 
total size of the text, how fast is fast enough, and possibly whether you’re 
writing to SSD or spinning hard drive.

Jim Crate

**********************************************************************
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