On 26/04/2022 10.54, Cameron Simpson wrote: > On 25Apr2022 08:08, DL Neil <pythonl...@danceswithmice.info> wrote: >> Thus, the observation that the OP may find that a serial, >> read-the-entire-file approach is faster is some situations (relatively >> short files). Conversely, with longer files, some sort of 'last chunk' >> approach would be superior. > > If you make the chunk big enough, they're the same algorithm! > > It sound silly, but if you make your chunk size as big as your threshold > for "this file is too big to read serially in its entirety, you may as > well just write the "last chunk" flavour.
I like it! Yes, in the context of memory-limited mainframes being in-the-past, and our thinking has, or needs to, moved-on; memory is so much 'cheaper' and thus available for use! That said, it depends on file-size and what else is going-on in the machine/total-application. (and that's 'probably not much' as far as resource-mix is concerned!) However, I can't speak for the OP, the reason behind the post, and/or his circumstances... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list