Commit 96ce41e4 authored by Thomas van Noort's avatar Thomas van Noort

Improved efficiency of reading a file by accumulating the result of 100...

Improved efficiency of reading a file by accumulating the result of 100 characters at a time, instead of 1000000


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@146 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent d58497dc
......@@ -214,12 +214,17 @@ readStateFile filename env
(_,env) = (NoDirError,env)
# (ok,file,env) = fopen (iDataStorageDir +++ "/" +++ filename +++ ".txt") FReadData env
| not ok = ("",env)
# (string,file) = freads file big
# (string,file) = freadfile file
| not ok = ("",env)
# (ok,env) = fclose file env
= (string,env)
where
big = 1000000
freadfile :: *File -> (String, *File)
freadfile file = rec file ""
where rec :: *File String -> (String, *File)
rec file acc # (string, file) = freads file 100
| string == "" = (acc, file)
| otherwise = rec file (acc +++ string)
deleteStateFile :: !String !*NWorld -> *NWorld
deleteStateFile filename env
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment