What is the differential speed of binary and text files?

I am developing a financial application that stores data in a file. I noticed that the input / output of text files is rather slow. If I switch to binary format, how much faster will it be? 2x? 10x? I could write my own time tests, but I hope someone else did it. Thanks in advance.

+3
source share
3 answers

Thanks for your thoughts, but since I'm looking for numbers, I decided to run my own tests.

Here are my results:

                    emulator   droid
integer text         5.478    0.028
integer binary       0.112    0.002
double text          6.546    0.187
double binary        0.117    0.003

integer text/bin      49       14

double text/bin       56       62

- , 100 . . , 14 62 . .

. , -, , - .

+5

. , ; .

, . , 1234567890 , . , 1 , int.

, . "" int double , , , /, ..

, , , .

. , N- . , 1 N-1 N. ​​

+5

File I / O is always much slower than doing things in RAM. Thus, using a binary file format will not help if your binary file is smaller than a text file that stores the same data. Actual acceleration will depend on how smaller your custom binary format is.

+2
source

Source: https://habr.com/ru/post/1759506/


All Articles