mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 23:12:10 -05:00
0c98d8e9ed
Simple ioutil.ReadFile is used for reading file contents but it reads all of the file contents and copies them into the memory and is run in a single goroutine. It causes much memory consumption at copying media files in content directory to publish directory and it is not good at performance. This improves the both issue by replacing ReadFile with LazyFileReader. It postpones reading the file contents until it is really needed. As the result, actual file read is run in parallelized goroutine. It improves performance especially in a really big site. In addition, if this reader is called from io.Copy, it does not copy the file contents into the memory but just copies them into destination file. It improves much memory consumption issue when the site has many media files. Fix #1181 |
||
---|---|---|
.. | ||
content_directory_test.go | ||
file.go | ||
file_test.go | ||
filesystem.go | ||
filesystem_test.go | ||
filesystem_unix_test.go | ||
filesystem_windows_test.go | ||
inmemory.go | ||
lazy_file_reader.go | ||
lazy_file_reader_test.go |