Skip to content

petershaw/charsinfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

charsinfile

Read a file by char in Swift

This project is a prototye to find out the fastest solution to read a file char by char.

Relates StackOverflow Thread: http://stackoverflow.com/questions/40450190/what-is-the-fastest-char-by-char-reader-in-swift And the "b" example from: http://stackoverflow.com/a/34595661/1187415 (Thanks to @RobNapier)

Testing the different solutions

  1. Generate a testfile:
openssl rand -out sample.txt -base64 $(( 2**30 * 3/4 ))
  1. test the file with both types:
time ./charsinfile sample.txt a -> result-a.txt
time ./charsinfile sample.txt b -> result-b.txt
  1. test the results:
diff sample.txt result-a.txt
diff sample.txt result-b.txt

About

Read a file by char in Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages