>> wtime_test 11-Aug-2010 15:08:32 WTIME_TEST MATLAB version. Demonstrate the use of the WTIME timer. TEST01 Time the RAND function: x = rand ( n, 1 ); Data vectors will be of minimum size 1024 Data vectors will be of maximum size 1048576 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 1024 0.000674 0.005703 0.005894 0.005602 0.005844 2048 0.000875 0.000825 0.000674 0.000644 0.000684 4096 0.001599 0.000875 0.000835 0.000855 0.001016 8192 0.001861 0.001167 0.001147 0.001157 0.001157 16384 0.002947 0.001992 0.002012 0.002183 0.001981 32768 0.005723 0.003651 0.003460 0.003651 0.003601 65536 0.010038 0.006498 0.006548 0.006528 0.006538 131072 0.019071 0.012502 0.012573 0.012613 0.012533 262144 0.038061 0.024462 0.024763 0.024371 0.024522 524288 0.073144 0.048632 0.048511 0.048722 0.048260 1048576 0.114373 0.095383 0.096238 0.095453 0.095866 11-Aug-2010 15:08:33 TEST02 Time vectorized operations: y(1:n) = x(1:n) y(1:n) = PI * x(1:n) ) y(1:n) = sqrt ( x(1:n) ) y(1:n) = exp ( x(1:n) ) Data vectors will be of minimum size 4096 Data vectors will be of maximum size 4194304 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.001640 0.001358 0.000935 0.000945 0.000935 8192 0.001579 0.001187 0.001167 0.001217 0.001167 16384 0.002434 0.001760 0.001780 0.001730 0.001700 32768 0.004506 0.002846 0.002957 0.002957 0.002967 65536 0.006498 0.005492 0.005391 0.005240 0.005240 131072 0.014021 0.010048 0.009636 0.009555 0.009706 262144 0.023818 0.020107 0.018155 0.018185 0.018115 524288 0.047163 0.038946 0.035566 0.034993 0.035486 1048576 0.093039 0.070026 0.069975 0.069623 0.068829 2097152 0.205360 0.149647 0.136642 0.136571 0.143512 4194304 0.376703 0.275104 0.272559 0.273334 0.284770 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.004556 0.001418 0.001147 0.001277 0.001147 8192 0.001579 0.001448 0.001821 0.001398 0.001418 16384 0.004647 0.002334 0.002696 0.002404 0.002323 32768 0.003983 0.003993 0.004737 0.003953 0.003983 65536 0.008057 0.007403 0.008399 0.007282 0.007363 131072 0.013840 0.013186 0.015359 0.013176 0.013347 262144 0.025317 0.025618 0.025508 0.025236 0.028405 524288 0.050472 0.049799 0.051961 0.049638 0.052917 1048576 0.098440 0.096590 0.095855 0.095513 0.107422 2097152 0.198369 0.193059 0.189850 0.191550 0.214503 4194304 0.383080 0.394285 0.381652 0.394526 0.380455 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.001448 0.001569 0.001418 0.001650 0.001287 8192 0.002102 0.003098 0.002012 0.001790 0.001760 16384 0.003772 0.003128 0.003007 0.003178 0.003017 32768 0.005371 0.006649 0.006739 0.005834 0.005472 65536 0.010048 0.011265 0.012583 0.010310 0.009917 131072 0.018759 0.021666 0.019412 0.023144 0.018588 262144 0.036683 0.042104 0.039388 0.041098 0.036029 524288 0.071253 0.082820 0.076453 0.079018 0.070951 1048576 0.139096 0.151991 0.148943 0.165197 0.141118 2097152 0.277277 0.289910 0.276965 0.291901 0.286460 4194304 0.583914 0.628090 0.644857 0.600892 0.553326 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.001589 0.001328 0.001338 0.001328 0.001348 8192 0.002092 0.001881 0.001841 0.002082 0.001841 16384 0.005874 0.003329 0.003219 0.003188 0.003249 32768 0.008167 0.005794 0.005673 0.005592 0.005693 65536 0.010501 0.010953 0.010551 0.012251 0.010601 131072 0.021293 0.019895 0.020167 0.021987 0.019815 262144 0.038694 0.039408 0.038805 0.045252 0.038785 524288 0.079118 0.076282 0.075930 0.087135 0.077771 1048576 0.151840 0.150371 0.154143 0.162984 0.151267 2097152 0.299455 0.300632 0.298620 0.320990 0.306204 4194304 0.603950 0.601787 0.683702 0.616683 0.586046 11-Aug-2010 15:09:09 TEST03 Time unvectorized operations: for i = 1 : n y(i) = x(i) y(i) = PI * x(i) ) y(i) = sqrt ( x(i) ) y(i) = exp ( x(i) ) end Data vectors will be of minimum size 4096 Data vectors will be of maximum size 4194304 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.001116 0.000664 0.000664 0.000664 0.000674 8192 0.001036 0.001016 0.000996 0.001006 0.001006 16384 0.002464 0.001690 0.001700 0.001710 0.001700 32768 0.003601 0.003078 0.003098 0.003199 0.003088 65536 0.005864 0.005753 0.005864 0.005844 0.005733 131072 0.011235 0.011145 0.011094 0.011145 0.011175 262144 0.021847 0.021786 0.021796 0.021887 0.021776 524288 0.043613 0.043070 0.043100 0.043220 0.043180 1048576 0.086220 0.085606 0.085878 0.085797 0.085324 2097152 0.172148 0.170870 0.171504 0.171403 0.170297 4194304 0.341599 0.340895 0.341257 0.341529 0.339910 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000694 0.000694 0.000935 0.000694 0.000674 8192 0.001046 0.001056 0.001036 0.000986 0.001026 16384 0.001810 0.001800 0.001891 0.001770 0.001740 32768 0.003199 0.005703 0.003712 0.003138 0.003249 65536 0.005904 0.006125 0.006467 0.006075 0.007252 131072 0.011466 0.011849 0.013619 0.011497 0.012724 262144 0.022450 0.023647 0.023949 0.023748 0.025005 524288 0.044870 0.044548 0.048300 0.045262 0.048411 1048576 0.088473 0.089006 0.094347 0.091158 0.097002 2097152 0.176201 0.192143 0.183493 0.190142 0.179923 4194304 0.351919 0.367852 0.362923 0.369089 0.379529 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.001006 0.000976 0.002263 0.000966 0.000966 8192 0.001780 0.001589 0.001579 0.001780 0.001579 16384 0.003007 0.004436 0.003148 0.002877 0.002867 32768 0.005552 0.005532 0.006749 0.005462 0.005472 65536 0.010632 0.010571 0.011889 0.010461 0.010501 131072 0.023436 0.022319 0.021927 0.020841 0.020690 262144 0.043603 0.043090 0.042567 0.040676 0.040605 524288 0.082488 0.084339 0.082066 0.082116 0.080597 1048576 0.173002 0.166062 0.175336 0.175044 0.168325 2097152 0.325486 0.331612 0.344929 0.347805 0.344718 4194304 0.646587 0.682233 0.681398 0.643449 0.684386 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000976 0.000966 0.000966 0.000966 0.000966 8192 0.001599 0.001599 0.001589 0.001579 0.001589 16384 0.002967 0.003128 0.002877 0.002877 0.002867 32768 0.005411 0.006719 0.005401 0.005421 0.005411 65536 0.010642 0.011879 0.010531 0.010772 0.010511 131072 0.020529 0.021474 0.020650 0.020459 0.020529 262144 0.042235 0.044236 0.040334 0.040464 0.040605 524288 0.088664 0.086712 0.080517 0.080667 0.080567 1048576 0.171544 0.167531 0.160631 0.160188 0.163326 2097152 0.333251 0.335957 0.334750 0.320940 0.319934 4194304 0.660588 0.668413 0.642191 0.641024 0.640522 11-Aug-2010 15:09:49 TEST04 Time the 2D nearest neighbor problem. Given X(2,N) and Y(2), find X(2,*) closest to Y(2). for i = 1 : n if distance ( x(2,i), y ) < minimum so far x_min = x(2,i) end Data vectors will be of minimum size 1024 Data vectors will be of maximum size 1048576 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 1024 0.000704 0.000533 0.000523 0.000503 0.000513 2048 0.000764 0.000664 0.000684 0.000684 0.000664 4096 0.001137 0.001036 0.001056 0.001076 0.001046 8192 0.002515 0.001821 0.001831 0.001821 0.001831 16384 0.003561 0.003359 0.003380 0.003370 0.003390 32768 0.006347 0.006427 0.006457 0.006437 0.006447 65536 0.012533 0.012452 0.012472 0.012472 0.012502 131072 0.024542 0.024492 0.024562 0.024552 0.024703 262144 0.047727 0.048592 0.048712 0.048732 0.048702 524288 0.094648 0.096700 0.096861 0.096922 0.096962 1048576 0.192053 0.193803 0.193491 0.193381 0.193421 11-Aug-2010 15:09:53 TEST05 Time the matrix multiplication problem. Compute C = A * B where A is an L by M matrix, B is an M by N matrix, and so C is an L by N matrix. Minimum value of L = M = N = 4 Maximum value of L = M = N = 1024 Number of repetitions of the operation: 5 Use triple loop for matrix multiplication. Timing results using nested loops: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4 0.000433 0.000332 0.000342 0.000332 0.000332 16 0.001861 0.001247 0.001217 0.001207 0.001448 64 0.064132 0.060239 0.059575 0.059626 0.061667 256 4.555869 4.250379 4.245923 4.327657 4.511704 Use C = A * B matrix multiplication. Timing results using C = A * B: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4 0.001992 0.000885 0.000935 0.000875 0.000885 16 0.000392 0.000282 0.000292 0.000272 0.000272 64 0.001388 0.000664 0.000674 0.000674 0.000704 256 0.012231 0.008962 0.008630 0.008379 0.008409 WTIME_TEST Normal end of execution. 11-Aug-2010 15:10:16 >>