From 051a6752413d9b421b22c4f86c0b8b4e986e7a98 Mon Sep 17 00:00:00 2001 From: deadwood Date: Sun, 18 May 2014 18:18:37 +0000 Subject: [PATCH] dos.library: use direct call to Read for reading larger buffers in LoadSeg. FRead reads once internal buffer at a time. Each such buffer read requires a context switch which can be expensive when reading large amounts of data. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49008 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/dos/loadseg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rom/dos/loadseg.c b/rom/dos/loadseg.c index 5d75e7af3c..35a22f2057 100644 --- a/rom/dos/loadseg.c +++ b/rom/dos/loadseg.c @@ -14,6 +14,8 @@ #include #include "dos_intern.h" +#define LOADSEG_BIG_READ 8192 + static AROS_UFH4(LONG, ReadFunc, AROS_UFHA(BPTR, file, D1), AROS_UFHA(APTR, buffer, D2), @@ -23,7 +25,10 @@ static AROS_UFH4(LONG, ReadFunc, { AROS_USERFUNC_INIT - return FRead(file, buffer, 1, length); + if (length > LOADSEG_BIG_READ) + return Read(file, buffer, length); + else + return FRead(file, buffer, 1, length); AROS_USERFUNC_EXIT } -- 2.11.4.GIT