queensoft Posted March 2 Share Posted March 2 Goal (excuse the non-technical terms, I will post picture and script to help ) : - read a file, binary format (you can use a JPG for testing) - FileOpen - $FO_BINARY (16) = Force binary mode - split the file in hex numbers, each represented by 2 characters - store everything in a simple 1D array Picture: - left side = Total Commander (either Compare files operation or View > Hex) - right side = _ArrayDisplay..... it is identical, so the output is perfect Problem: - FileOpen & FileRead & BinaryLen = all work great - now, splitting the file into hex numbers: I have tried many solutions, finally settled on DllStructCreate & DllStructSetData - BUT, this is very slow, at least 6-7 seconds for a 2 Mb file (i7 7700K @ 4.5 GHz, 16 Gb RAM) #include <File.au3> #include <Array.au3> #include <AutoItConstants.au3> $s = TimerInit() Local $hFileOpen = FileOpen('Image1.jpg', 16) ; 16+0=Read binary Local $sFileRead = FileRead($hFileOpen) FileClose($hFileOpen) Local $File_struct = DllStructCreate("BYTE File[" & BinaryLen($sFileRead) & "]") DllStructSetData($File_struct, "File", $sFileRead) Local $iSize = BinaryLen($sFileRead) Local $aByte[$iSize] For $i = 0 To $iSize - 1 if Mod($i+1, 10000) = 0 Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $i = ' & $i & ' of ' & $iSize - 1 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $aByte[$i] = hex(DllStructGetData($File_struct, "File",$i),2) Next ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : = ' & TimerDiff($s)/1000 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console _ArrayDisplay($aByte, '', "500") ; show only the first 500 lines How do I do the splitting faster?? I need to read [tens of] thousands of files. Thank you. Link to comment Share on other sites More sharing options...
ioa747 Posted March 2 Share Posted March 2 (edited) maybe it has to do with the file? with this file https://www.autoitscript.com/forum/uploads/profile/photo-30661.jpg console out: @@ Debug(23) : = 0.0092673 Edit: with this file https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg console out: @@ Debug(23) : = 0.8744486 Spoiler expandcollapse popup@@ Debug(19) : $i = 9999 of 279602 >Error code: 0 @@ Debug(19) : $i = 19999 of 279602 >Error code: 0 @@ Debug(19) : $i = 29999 of 279602 >Error code: 0 @@ Debug(19) : $i = 39999 of 279602 >Error code: 0 @@ Debug(19) : $i = 49999 of 279602 >Error code: 0 @@ Debug(19) : $i = 59999 of 279602 >Error code: 0 @@ Debug(19) : $i = 69999 of 279602 >Error code: 0 @@ Debug(19) : $i = 79999 of 279602 >Error code: 0 @@ Debug(19) : $i = 89999 of 279602 >Error code: 0 @@ Debug(19) : $i = 99999 of 279602 >Error code: 0 @@ Debug(19) : $i = 109999 of 279602 >Error code: 0 @@ Debug(19) : $i = 119999 of 279602 >Error code: 0 @@ Debug(19) : $i = 129999 of 279602 >Error code: 0 @@ Debug(19) : $i = 139999 of 279602 >Error code: 0 @@ Debug(19) : $i = 149999 of 279602 >Error code: 0 @@ Debug(19) : $i = 159999 of 279602 >Error code: 0 @@ Debug(19) : $i = 169999 of 279602 >Error code: 0 @@ Debug(19) : $i = 179999 of 279602 >Error code: 0 @@ Debug(19) : $i = 189999 of 279602 >Error code: 0 @@ Debug(19) : $i = 199999 of 279602 >Error code: 0 @@ Debug(19) : $i = 209999 of 279602 >Error code: 0 @@ Debug(19) : $i = 219999 of 279602 >Error code: 0 @@ Debug(19) : $i = 229999 of 279602 >Error code: 0 @@ Debug(19) : $i = 239999 of 279602 >Error code: 0 @@ Debug(19) : $i = 249999 of 279602 >Error code: 0 @@ Debug(19) : $i = 259999 of 279602 >Error code: 0 @@ Debug(19) : $i = 269999 of 279602 >Error code: 0 @@ Debug(23) : = 0.8744486 Edited March 2 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
Danyfirex Posted March 2 Share Posted March 2 You could use RegExp. StringRegExp($sFileRead,".{2}",3) But for displaying(_ArrayDisplay) it would take a bunch of time for large array. (Probably a fast display or virtual UDF would help.) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
UEZ Posted March 2 Share Posted March 2 (edited) This should be faster: ;Coded by UEZ build 2024-03-02 #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Global $sFile = "Captured.bmp" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _WinAPI_File2Hex1DArray($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ;~ _ArrayDisplay($a1D) Func _WinAPI_File2Hex1DArray($sFile) Local $iSize = FileGetSize($sFile) If @error Or Not $iSize Then Return SetError(1, 0, 0) Local $tBuffer = DllStructCreate("byte data[" & $iSize & "]"), $nBytes Local $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iSize, $nBytes) _WinAPI_CloseHandle($hFile) Local $aResult = StringRegExp(Binary($tBuffer.data), ".{2}", 3, 3) $tBuffer = Null Return $aResult EndFunc Edited March 2 by UEZ argumentum, queensoft and Danyfirex 2 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 2 Moderators Share Posted March 2 (edited) I like UEZs approach. Here's the same approach with AutoIt default funcs (speed is very similar though). #include <Array.au3> #include <FileConstants.au3> #include <StringConstants.au3> Global $sFile = "Captured.bmp" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _Aut_File2Hex1DArray($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ConsoleWrite("BYTES: " & UBound($a1D) & " : 1ST BYTE: " & $a1D[0] & @CRLF) ;~ _ArrayDisplay($a1D) Func _Aut_File2Hex1DArray($sFile) If Not FileExists($sFile) Then Return SetError(1, 0, 0) Local $hFile = FileOpen($sFile, $FO_BINARY) Local $nBytes = FileRead($hFile) FileClose($hFile) Return StringRegExp($nBytes, ".{2}", $STR_REGEXPARRAYGLOBALMATCH, 3) EndFunc Edited March 2 by SmOke_N Forgot to offset the "0x" prefix queensoft 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
UEZ Posted March 2 Share Posted March 2 Here another way which seems to be litte faster then my previous version above: ;Coded by UEZ build 2024-03-02 #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Const $CRYPT_STRING_HEX = 4, $CRYPT_STRING_NOCRLF = 0x40000000 Global $sFile = "LCD_Test.png" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _WinAPI_File2Hex1DArray2($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ;_ArrayDisplay($a1D) Func _WinAPI_File2Hex1DArray2($sFile) Local $iSize = FileGetSize($sFile) If @error Or Not $iSize Then Return SetError(1, 0, 0) Local $tBuffer = DllStructCreate("byte data[" & $iSize & "]"), $nBytes Local $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iSize, $nBytes) _WinAPI_CloseHandle($hFile) Local $tOut = DllStructCreate("char hex[" & DllCall("Crypt32.dll", "bool", "CryptBinaryToStringA", "struct*", $tBuffer, "dword", DllStructGetSize($tBuffer), "dword", $CRYPT_STRING_HEX + $CRYPT_STRING_NOCRLF, "struct*", Null, "dword*", Null)[5] & "]") DllCall("Crypt32.dll", "bool", "CryptBinaryToStringA", "struct*", $tBuffer, "dword", DllStructGetSize($tBuffer), "dword", $CRYPT_STRING_HEX + $CRYPT_STRING_NOCRLF, "struct*", $tOut, "dword*", DllStructGetSize($tOut)) Local $aResult = StringSplit(BinaryToString($tOut.hex), " ", $STR_NOCOUNT) $tBuffer = Null Return $aResult EndFunc SmOke_N and queensoft 1 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 2 Moderators Share Posted March 2 @UEZ, very nice, that's like 10+% faster than the other versions. UEZ 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jchd Posted March 2 Share Posted March 2 5 hours ago, queensoft said: - store everything in a simple 1D array Remember that AutoIt arrays can't store more than 2^24 = 16777216 elements. Now what's the real purpose of all this, instead of viewing the binary file using any hex editor? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
UEZ Posted March 2 Share Posted March 2 Additionally, displaying an array for 1mb+ files takes very long which makes no sense... Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
mLipok Posted March 2 Share Posted March 2 You should read only part of file not entire at once. Display only part then goes to next part when user choose to look at the next part. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 2 Moderators Share Posted March 2 1 hour ago, jchd said: Remember that AutoIt arrays can't store more than 2^24 = 16777216 elements. Now what's the real purpose of all this, instead of viewing the binary file using any hex editor? What is that, like a 15mb file? 😲 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 (edited) 15 hours ago, ioa747 said: maybe it has to do with the file? with this file https://www.autoitscript.com/forum/uploads/profile/photo-30661.jpg console out: @@ Debug(23) : = 0.0092673 Edit: with this file https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg console out: @@ Debug(23) : = 0.8744486 Reveal hidden contents expandcollapse popup@@ Debug(19) : $i = 9999 of 279602 >Error code: 0 @@ Debug(19) : $i = 19999 of 279602 >Error code: 0 @@ Debug(19) : $i = 29999 of 279602 >Error code: 0 @@ Debug(19) : $i = 39999 of 279602 >Error code: 0 @@ Debug(19) : $i = 49999 of 279602 >Error code: 0 @@ Debug(19) : $i = 59999 of 279602 >Error code: 0 @@ Debug(19) : $i = 69999 of 279602 >Error code: 0 @@ Debug(19) : $i = 79999 of 279602 >Error code: 0 @@ Debug(19) : $i = 89999 of 279602 >Error code: 0 @@ Debug(19) : $i = 99999 of 279602 >Error code: 0 @@ Debug(19) : $i = 109999 of 279602 >Error code: 0 @@ Debug(19) : $i = 119999 of 279602 >Error code: 0 @@ Debug(19) : $i = 129999 of 279602 >Error code: 0 @@ Debug(19) : $i = 139999 of 279602 >Error code: 0 @@ Debug(19) : $i = 149999 of 279602 >Error code: 0 @@ Debug(19) : $i = 159999 of 279602 >Error code: 0 @@ Debug(19) : $i = 169999 of 279602 >Error code: 0 @@ Debug(19) : $i = 179999 of 279602 >Error code: 0 @@ Debug(19) : $i = 189999 of 279602 >Error code: 0 @@ Debug(19) : $i = 199999 of 279602 >Error code: 0 @@ Debug(19) : $i = 209999 of 279602 >Error code: 0 @@ Debug(19) : $i = 219999 of 279602 >Error code: 0 @@ Debug(19) : $i = 229999 of 279602 >Error code: 0 @@ Debug(19) : $i = 239999 of 279602 >Error code: 0 @@ Debug(19) : $i = 249999 of 279602 >Error code: 0 @@ Debug(19) : $i = 259999 of 279602 >Error code: 0 @@ Debug(19) : $i = 269999 of 279602 >Error code: 0 @@ Debug(23) : = 0.8744486 Those files are very small. My files are at least 2 Mb. I tested with EXE, JPG and MP3, same slow processing. I have to process thousands of files, the difference from 5-7 seconds to.... let's hope 2-3 seconds, is huge. Edited March 3 by queensoft Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 14 hours ago, Danyfirex said: You could use RegExp. StringRegExp($sFileRead,".{2}",3) But for displaying(_ArrayDisplay) it would take a bunch of time for large array. (Probably a fast display or virtual UDF would help.) Saludos Already tried that - at least 2 different RegExp - even slower. No need for _ArrayDisplay, I only check the first 100-500 results. Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 13 hours ago, UEZ said: This should be faster: ;Coded by UEZ build 2024-03-02 #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Global $sFile = "Captured.bmp" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _WinAPI_File2Hex1DArray($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ;~ _ArrayDisplay($a1D) Func _WinAPI_File2Hex1DArray($sFile) Local $iSize = FileGetSize($sFile) If @error Or Not $iSize Then Return SetError(1, 0, 0) Local $tBuffer = DllStructCreate("byte data[" & $iSize & "]"), $nBytes Local $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iSize, $nBytes) _WinAPI_CloseHandle($hFile) Local $aResult = StringRegExp(Binary($tBuffer.data), ".{2}", 3, 3) $tBuffer = Null Return $aResult EndFunc Much much much better, slightly under 1 second!!!! I was going to ask "how come this StringRegExp is so fast?" but then I remembered I absolutely do not understand StringRegExp, so I'm not gonna ask that. But I did I test one of my previous attempts and now I get similar results, around 1.1 - 1.2 seconds: StringRegExp($aData[1], ".{2}", 3) It uses: CryptBinaryToString function (Windows) ; http://msdn.microsoft.com/en-us/library/windows/desktop/aa379887(v=vs.85).aspx I think the _ArrayDisplay was throwing me off track, I later realised that is taking a huge time also. Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 12 hours ago, SmOke_N said: I like UEZs approach. Here's the same approach with AutoIt default funcs (speed is very similar though). #include <Array.au3> #include <FileConstants.au3> #include <StringConstants.au3> Global $sFile = "Captured.bmp" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _Aut_File2Hex1DArray($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ConsoleWrite("BYTES: " & UBound($a1D) & " : 1ST BYTE: " & $a1D[0] & @CRLF) ;~ _ArrayDisplay($a1D) Func _Aut_File2Hex1DArray($sFile) If Not FileExists($sFile) Then Return SetError(1, 0, 0) Local $hFile = FileOpen($sFile, $FO_BINARY) Local $nBytes = FileRead($hFile) FileClose($hFile) Return StringRegExp($nBytes, ".{2}", $STR_REGEXPARRAYGLOBALMATCH, 3) EndFunc Indeed, similar results. Maybe faster because of no DLL calls?! Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 10 hours ago, UEZ said: Here another way which seems to be litte faster then my previous version above: ;Coded by UEZ build 2024-03-02 #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Const $CRYPT_STRING_HEX = 4, $CRYPT_STRING_NOCRLF = 0x40000000 Global $sFile = "LCD_Test.png" ConsoleWrite("File size = " & FileGetSize($sFile) & @CRLF) Global $t = TimerInit() Global $a1D = _WinAPI_File2Hex1DArray2($sFile) ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ;_ArrayDisplay($a1D) Func _WinAPI_File2Hex1DArray2($sFile) Local $iSize = FileGetSize($sFile) If @error Or Not $iSize Then Return SetError(1, 0, 0) Local $tBuffer = DllStructCreate("byte data[" & $iSize & "]"), $nBytes Local $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iSize, $nBytes) _WinAPI_CloseHandle($hFile) Local $tOut = DllStructCreate("char hex[" & DllCall("Crypt32.dll", "bool", "CryptBinaryToStringA", "struct*", $tBuffer, "dword", DllStructGetSize($tBuffer), "dword", $CRYPT_STRING_HEX + $CRYPT_STRING_NOCRLF, "struct*", Null, "dword*", Null)[5] & "]") DllCall("Crypt32.dll", "bool", "CryptBinaryToStringA", "struct*", $tBuffer, "dword", DllStructGetSize($tBuffer), "dword", $CRYPT_STRING_HEX + $CRYPT_STRING_NOCRLF, "struct*", $tOut, "dword*", DllStructGetSize($tOut)) Local $aResult = StringSplit(BinaryToString($tOut.hex), " ", $STR_NOCOUNT) $tBuffer = Null Return $aResult EndFunc Holy Cow! Indeed faster, about 15-25% faster, down to 0.75 seconds. Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 10 hours ago, jchd said: Remember that AutoIt arrays can't store more than 2^24 = 16777216 elements. Now what's the real purpose of all this, instead of viewing the binary file using any hex editor? I'm well under the 16 Mb file size. The purpose is to compare / extract / save the differences between 2 .bin files, rinse, repeat with thousands of files. Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 10 hours ago, UEZ said: Additionally, displaying an array for 1mb+ files takes very long which makes no sense... The _ArrayDisplay is just for checking the results. Link to comment Share on other sites More sharing options...
queensoft Posted March 3 Author Share Posted March 3 9 hours ago, mLipok said: You should read only part of file not entire at once. Display only part then goes to next part when user choose to look at the next part. I need the entire file (files - 2, see reply above) at once. Link to comment Share on other sites More sharing options...
jchd Posted March 3 Share Posted March 3 1 hour ago, queensoft said: No need for _ArrayDisplay, I only check the first 100-500 results. 1 hour ago, queensoft said: I need the entire file (files - 2, see reply above) at once. All this is nonsensical. Tell us what's the REAL purpose. No, you aren't going to visually compare hex byte to hex byte [tens of] thousands 2Mb files. Tell us what you're really after and maybe we can help. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now