Skip to content

Commit

Permalink
Update Sort comparison tests (chapel-lang#24051)
Browse files Browse the repository at this point in the history
These tests are not run in any testing config & only run manually.

This PR updates a few tests to fix incorrect comments, handle Python 3
deprecation of `time.clock()`, and handle Chapel changes.

Test change only -- not reviewed.
  • Loading branch information
mppf authored Dec 12, 2023
2 parents 607b5e4 + 76d15ad commit e6f0a6d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// chpl --fast chapel-quicksort-random.chpl

use Sort;
use QuickSort;
use Time;
use Random;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import random
import time

#n = 1024*1024*16 # for 128MiB
n = 1024*1024*128 # for 1GiB
#n = 1024*1024*16 # for 16MiB
n = 1024*1024*128 # for 128MiB

# Note, this actually never generates the maximal element... oh well.
array = numpy.random.randint(0, 0xffffffffffffffff, size=n, dtype=numpy.uint64)

start = time.clock()
start = time.time()
array.sort()
stop = time.clock()
stop = time.time()

print ("Sorted ", n, " elements in ", stop-start, " seconds")
print (((8*n) / (stop-start))/1024.0/1024.0, " MiB/s")
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import random
import time

#n = 1024*1024*16 # for 128MiB
n = 1024*1024*128 # for 1GiB
#n = 1024*1024*16 # for 16MiB
n = 1024*1024*128 # for 128MiB

array = [random.randint(0, 0xffffffffffffffff) for _ in range(n)]
start = time.clock()
start = time.time()
array.sort()
stop = time.clock()
stop = time.time()

print ("Sorted ", n, " elements in ", stop-start, " seconds")
print (((8*n) / (stop-start))/1024.0/1024.0, " MiB/s")

0 comments on commit e6f0a6d

Please sign in to comment.