Code Sort
- Posted by Tristen Wilson <wood_dip_kill at yahoo.com> Jun 18, 2007
- 537 views
include get.e include misc.e include machine.e include file.e include graphics.e procedure getnum() integer num atom low, med, high, vlow, elow, t1, t2, t3, t4, maxt1, maxt2, maxt3, maxt4 atom t5, maxt5 num = prompt_number("Please enter Number to break: ", {1, 999999}) if num < 100 then t5 = time() for m = 0 to 900 do elow = rand(100) if elow != num then -- We want super fast execution else maxt5 = time() - t5 printf(1, "It took %d calls to ELow\n Time was %f seconds\n", {m, maxt5}) sleep(3) abort(1) end if end for else if num < 500 then t4 = time() for k = 0 to 9999 do vlow = rand(500) if vlow != num then -- We want super fast execution else maxt4 = time() - t4 printf(1, "It took %d calls to VLow\nTime was %f seconds\n", {k, maxt4}) sleep(3) abort(1) end if end for else if num < 1000 then t1 = time() for i = 0 to 999999 do low = rand(999) if low != num then -- We want super fast execution else maxt1 = time() - t1 printf(1, "It took %d calls to Low\nTime was %f seconds\n", {i, maxt1}) sleep(2) abort(1) end if end for else if num < 500000 then t2 = time() for j = 0 to 99999999 do med = rand(500000) if med != num then else maxt2 = time() - t2 printf(1, "It took %d calls to Med\nTime was %f seconds\n", {j, maxt2}) sleep(2) abort(1) end if end for else if num > 500000 then t3 = time() for h = 0 to 9999999 do high = rand(999999) if high != num then -- We want super fast execution else maxt3 = time() - t3 printf(1, "It took %d calls to High\n Time was %f seconds\n", {h, maxt3}) sleep(3) abort(1) end if end for end if end if end if end if end if end procedure text_color(RED) puts(2, "Number Finder v1.1") text_color(CYAN) puts(2, " Uses a new algorithm: ") text_color(GREEN) puts(2, "level-find\n\n") sleep(2) text_color(WHITE) puts(2, "Numbers per Second has been disabled due to time() returning 0.9 or lower\n") sleep(4) getnum()
Benchmark Tests 9:17 PM 6/17/2007 Codes Per Second Benchmarking Test Code: 200759 Algorithm(s): level_find, find find is an unused algorithm due to speed issues, all algorithms use rand() function to find code in unison with "for i = x to y do" looping. CPS is calculated by dividing the number of loops by the time it took to find the code. (Currently Disabled) The level_find Algorithm works by sorting the number into it's respective function by determining how many digits it has and how large it is. Then, Rand() chooses a number and compares it to the code, if it doesn't match, then it loops back and does it again. When it finds the code, it prints the data to the screen telling you how long it took and how many calls the function it used. (Example Below) if code < 500 timer = time() for x = x to y do low = rand(500) -- Low is the "Low" end of the code breaker, if low != code then -- If the number is below 500, it uses this call. -- This is blank to help keep it fast else extime = time() - timer -- This give an Accurate measure of time printf("It took %d calls to low\nTime was %f", {low, extime}) else if code < 5000 then timer = time() for x = x to y do med = rand(5000) -- Currently no way to set a low number. EXAMPLE: rand(500, 5000) -- END You know the rest With App means running with other Apps in background Run 1: Without App, Using level_find Calls: 254215 Time: 0.050000 Run 2: With App, Using level_find Calls: 860968 Time: 0.220000 Run 3: With App, Using level_find Calls: 776643 Time: 0.220000 Run 4: With App, Using level_find Calls: 560809 Time: 0.110000 Run 5: With App, Using level_find Calls: 56258 Time: Unknown Maximum CPS on a 1.7GHz 100MHz FSB 640 MB RAM at 400MHz (Estimated) : Time: 0.15 Avg. Calls: 501,778 Max CPS: 3,345,186 Now Thats FAST!