# "Write to text file" performance

**URL:** <https://www.finalbuilder.com/forums/t/write-to-text-file-performance/2907>\
**Category:** Bugs\
**Created:** [October 2, 2007, 6:52am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-performance/2907 "2007-10-02T06:52:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)\
**Post date:** [October 2, 2007, 6:52am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-performance/2907/1 "2007-10-02T06:52:39Z")

</div>

The "write to text file" action seems to perform very badly in "append" mode on large files, almost as if it's reading the entire file in before writing any output. This means that any build which continually writes output to a text file will get slower and slower - the action takes milliseconds on an empty file, but 4 seconds on a 20 megabyte file. That means a build which writes say 10 times to that logfile per cycle in the build is going to be spending 95% of its time just on the logging!

Is there a faster way to write (in append mode) to a text file? Or maybe there's some workaround?

As a test, I replaced the write step by two steps: write to a text file, then spawn a dos shell to "type foo.txt \>\>bar.txt" - this is actually much faster, taking .5s (rather than 3-4 seconds). That seems really strange.

Slightly faster is replacing both lines with a single DOS command: echo "the text I want to write" \>\> bar.txt

Is there a better way?

Steve

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [October 2, 2007, 9:41am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-performance/2907/2 "2007-10-02T09:41:47Z")

</div>

Hi Steve   
  
 We should have a fix for this tomorrow, Angus did some work on this today and got a big improvement on performance, will need a bit more testing tomorrow before we roll the change into a build.

---

<div class="post-metadata">

**Author:** ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)\
**Post date:** [October 3, 2007, 5:56am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-performance/2907/3 "2007-10-03T05:56:31Z")

</div>

Awesome!   
  
 Steve

---

<div class="post-metadata">

**Author:** ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)\
**Post date:** [October 3, 2007, 6:00am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-performance/2907/4 "2007-10-03T06:00:23Z")

</div>

Hi Steve,   
  
 This test build should give vastly better performance:   
  
 [https://www.finalbuilder.com/downloads/finalbuilder/550/FB550\_420.exe](https://www.finalbuilder.com/downloads/finalbuilder/550/FB550_420.exe)   
  
 Regards,   
  
 Angus
