Re: [Gambas-user] My quest for efficiency

2017-07-16 Thread Fernando Cabral
Thank you, Caveat [emptor?]. The code you proposed worked very, very well. In fact, I timed it against two versions of the C program and the result was quite good. In C, reading from the standard input and writing to the standard output took a trifle beyond half a second (0.6?? real time). Meanwhi

Re: [Gambas-user] My quest for efficiency

2017-07-15 Thread Caveat
Something is horribly wrong, or you're running on a 286 :-) I just tested here, and the program runs on a 51 MB test file in about 5 seconds. Some reasonably well commented code for you... Public Sub Main() Dim inFile, outFile As File Dim buff As New Byte[1024] Dim idx, remBytes, readS

Re: [Gambas-user] My quest for efficiency

2017-07-15 Thread Benoît Minisini via Gambas-user
Le 15/07/2017 à 20:49, Tony Morehen a écrit : Did you try Benoit's suggestion: Public Sub Main() Dim sIn as String Dim sOut as String sIn = File.Load("/home/fernando/temp/deah001.dhn") sOut = Add11(sIn) File.Save("/home/fernando/temp/deah001.11Added.dhn", sOut) End Public Sub

Re: [Gambas-user] My quest for efficiency

2017-07-15 Thread Tony Morehen
Did you try Benoit's suggestion: Public Sub Main() Dim sIn as String Dim sOut as String sIn = File.Load("/home/fernando/temp/deah001.dhn") sOut = Add11(sIn) File.Save("/home/fernando/temp/deah001.11Added.dhn", sOut) End Public Sub Add11(InputString as String) as String Dim bArray

Re: [Gambas-user] My quest for efficiency

2017-07-15 Thread Fernando Cabral
Well, after 5 hours the most efficient version is still running. Only 1/5 of the file has been processed. The less efficient version has only processed 1 MB, or 1/ 42 of the file. So I decided to write a C program to do the same task. Since I have not been using C in the last 20 years, I did not t

Re: [Gambas-user] My quest for efficiency

2017-07-15 Thread Benoît Minisini via Gambas-user
Le 15/07/2017 à 16:08, Fernando Cabral a écrit : Hi I've found a file whose text has been obfuscated by subtracting 11 from every byte. Now I want to bring it back to regular text. To do this I have to add 11 to each byte read from that file. Now, I have tried several ways to do it, and they all

[Gambas-user] My quest for efficiency

2017-07-15 Thread Fernando Cabral
Hi I've found a file whose text has been obfuscated by subtracting 11 from every byte. Now I want to bring it back to regular text. To do this I have to add 11 to each byte read from that file. Now, I have tried several ways to do it, and they all seemed every inefficient to me. Two examples follo