randallc Posted September 11, 2007 Share Posted September 11, 2007 (edited) Hi, I have the 1D sort working, and it is 8-10x faster than _arraySort on 1D. [ ** Numeric and case-sensitive only at present.....], and reported slower than Clib sort if long strings... The 2D is a lot slower than my vbs sort routine (already 6x faster than _ArraySort); unless there is a way I don't know; looks like jscript does not use same fast sort for 2D (its 2D arrays are arrays of single arrays essentially! - I think!) Best, randall ; jscript3.au3 #include-once #Include <Array.au3> Global $arr1D = StringSplit("19274948","") _ArrayDisplay($arr1D,"$arr1D unsorted") Global $arr2D[6][4] = [["a0", "b3", "c9", "1"], ["a0", "b1", "c3", "11"], ["a0", "b2", "c2", "3"], ["a0", "b0", "c8", "0"], ["a4", "b4", "c7", "5"], ["a5", "5", "5", "4"]] _ArrayDisplay($arr2D,"$arr2D unsorted") _JSort1D($arr1D) _ArrayDisplay($arr1D,"$arr1D sorted") _JSort2D($arr2D) _ArrayDisplay($arr2D,"$arr2D sorted") Func _JSort1D(ByRef $arEither2D1D) Local $code = ' function SortArray(arrArray) {' $code &= @LF & ' return arrArray.toArray().sort().join("|");' $code &= @LF & ' }' Local $jvs = ObjCreate("ScriptControl") $jvs.language = "jscript" $jvs.Timeout = -1 $jvs.addcode ($code) ;~ FileWrite(@ScriptDir & "\subsortIntroau3a.jvs", $code) Local $arEither2D1DSt = $jvs.Run("SortArray", $arEither2D1D);, $iIndex, $icase) $arEither2D1D = StringSplit($arEither2D1DSt, "|") $jvs = "" EndFunc ;==>_JSort1D; Edited February 1, 2008 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
randallc Posted January 6, 2008 Author Share Posted January 6, 2008 (edited) hi,Nutster has a good review of programming in a series of functions in a new thread;Sorting FunctionsI have moved my extra sort tests here from there, and used some of his funcs for comparison.vbs sort specifically for numbers and case sensitive is probably better value overall for 1D. [strings case insensitive not tested yet, and will obviously be slower overall]Best, RandallSorts_TestRJC.zip Edited January 6, 2008 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW 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