Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Sort by first part of line

From: carl:cybercraft at: 7-Sep-2002 18:42

On 07-Sep-02, [SunandaDH--aol--com] wrote:
> Joel: >> Someone who's already been benchmarking might try comparing this >> with what's already been proposed, using the data from your web >> site. > Done that!! > Timings I get are: > 47.29 -- Sunanda's parse in the Sort > 8.62 -- Gregg's parse before the sort > 2.25 -- Joel's bridge sort > You are today's lucky benchmark winner!!!
> I'm kinda interested in how these perform on machines with far less > memory that Joel's or mine.
Well, it was time for a cuppa anyway... (: So, on a slowww Amiga I got... 33:33.21 -- Sunanda's parse in the Sort 02:26.75 -- Gregg's parse before the sort 01:17.20 -- Joel's bridge sort And, out of interest, I converted my index-sort to work with the file in memory, (since you kindly left out disk-access in the timing:), and got a result of 01:48.26. Joel's method still wins though. (: I've 32megs, but didn't have any memory problems. Here's my code, with an updated verify tacked on the end. Note how I saved the sorted block. Simplier than looping through it, and much quicker, at least on this machine. ;; Carl -- index sort ;; ------------------- unset 'sorted-data recycle report-item/start "index sort" file-index: array 2 * length? data ptr: 1 foreach item data [ poke file-index ptr copy/part item 4 poke file-index ptr + 1 item ptr: ptr + 2 ] sorted-data: extract next sort/skip file-index 2 2 report-item/end "index sort" write/lines %sorted-data-index.txt sorted-data unset 'sorted-data recycle ;; Verify sort results ;; =================== report-item/start "verifying results are the same" parsed-file: read %sorted-data-parse.txt pre-parsed-file: read %sorted-data-pre-parsed.txt bridge-file: read %sorted-data-bridge.txt index-file: read %sorted-data-index.txt either all [parsed-file = pre-parsed-file parsed-file = bridge-file parsed-file = index-file ] [print "got same results"] [print "bad code in there somewhere"] report-item/end "verifying results are the same" print "done" -- Carl Read