On 11 Nov 2018, at 10:29, Alistair Grant <akgrant0710@gmail.com> wrote:
File is a low level API that is only used in limited circumstances, e.g. bootstrapping when FileSystem isn't yet available.
Another reason not to use File is because it is slower as it is unbuffered. For the following file $ file test.png test.png: PNG image data, 950 x 936, 8-bit/color RGBA, non-interlaced $ ls -la test.png -rw-r--r--@ 1 sven staff 241773 Nov 11 13:39 test.png I get [ ImageReadWriter formFromFileNamed: 'test.png' ] bench. "'8.725 per second'" [ ImageReadWriter formFromStream: 'test.png' asFileReference binaryReadStream ] bench. "'8.914 per second'" [ ImageReadWriter formFromStream: (File named: 'test.png') readStream ] bench. "'6.023 per second'" By preventing the auto detection of the type and the subclass lookup, we can improve a little bit more. [ PNGReadWriter formFromStream: 'test.png' asFileReference binaryReadStream ] bench. "'9.113 per second'" Sven