R Richard Peck Member Licensed User Longtime User Jan 17, 2014 #1 Hi All Can anyone tell me the fastest way to condense of 2 files. I've tried the normal file access and I've tried the RandomAccessFile library with 8 byte access but both a really slow. Any know a faster way ? Thanks
Hi All Can anyone tell me the fastest way to condense of 2 files. I've tried the normal file access and I've tried the RandomAccessFile library with 8 byte access but both a really slow. Any know a faster way ? Thanks
JakeBullet70 Well-Known Member Licensed User Longtime User Jan 17, 2014 #2 If you are compiling with rapid - debug its going to be slow. try it compiled to release mode to see the real speed. Upvote 0
If you are compiling with rapid - debug its going to be slow. try it compiled to release mode to see the real speed.
R Richard Peck Member Licensed User Longtime User Jan 18, 2014 #3 Hi, I have compiled it as a release but it's still very slow. Is the a faster way to do a file compare then the ways I mentioned ? Is there any other libraries I can try. Any other thought would be helpful. Thanks Upvote 0
Hi, I have compiled it as a release but it's still very slow. Is the a faster way to do a file compare then the ways I mentioned ? Is there any other libraries I can try. Any other thought would be helpful. Thanks
DonManfred Expert Licensed User Longtime User Jan 18, 2014 #4 How did you the compare? are you comparing each single byte? I would try to read 8k or 16k (or more) in a string and then a string-compare of these 8/16kb each... Maybe post your code (export as zip) and we have a look Upvote 0
How did you the compare? are you comparing each single byte? I would try to read 8k or 16k (or more) in a string and then a string-compare of these 8/16kb each... Maybe post your code (export as zip) and we have a look
Erel B4X founder Staff member Licensed User Longtime User Jan 18, 2014 #5 You shouldn't convert the bytes to a string. It will only make it slower (and not 100% accurate). The fastest way will be to first check whether the files sizes are the same and then compare the raw bytes with InputStreams. A library will not make it faster. Upvote 0
You shouldn't convert the bytes to a string. It will only make it slower (and not 100% accurate). The fastest way will be to first check whether the files sizes are the same and then compare the raw bytes with InputStreams. A library will not make it faster.
R Richard Peck Member Licensed User Longtime User Jan 18, 2014 #6 DonManfred said: How did you the compare? are you comparing each single byte? I would try to read 8k or 16k (or more) in a string and then a string-compare of these 8/16kb each... Maybe post your code (export as zip) and we have a look Click to expand... Right now I'm doing 8 byte compares. I'm not sure how you would do a 16k compare, can you give a shore example ? Thanks Upvote 0
DonManfred said: How did you the compare? are you comparing each single byte? I would try to read 8k or 16k (or more) in a string and then a string-compare of these 8/16kb each... Maybe post your code (export as zip) and we have a look Click to expand... Right now I'm doing 8 byte compares. I'm not sure how you would do a 16k compare, can you give a shore example ? Thanks
DonManfred Expert Licensed User Longtime User Jan 19, 2014 #7 I would do it like this on Windows if i code with delphi. But as Arel states on post before yours it is not a good idea to to a string-compare cause it where not 100% accurate. Upvote 0
I would do it like this on Windows if i code with delphi. But as Arel states on post before yours it is not a good idea to to a string-compare cause it where not 100% accurate.
warwound Expert Licensed User Longtime User Jan 19, 2014 #8 How about generating an MD5 checksum for each file? http://www.b4x.com/android/forum/threads/how-to-get-md5-of-a-file.7332/#post-41864 Martin. Upvote 0
How about generating an MD5 checksum for each file? http://www.b4x.com/android/forum/threads/how-to-get-md5-of-a-file.7332/#post-41864 Martin.
DonManfred Expert Licensed User Longtime User Jan 19, 2014 #9 That would be a GOOD alternative ;-) But i think it could be to slow too if the files are big... Upvote 0
warwound Expert Licensed User Longtime User Jan 19, 2014 #10 If the files are big then i think any solution will be slow... Martin. Upvote 0
DonManfred Expert Licensed User Longtime User Jan 19, 2014 #11 Richard did not state any informations about the filesizes the files have which he tried Upvote 0