[Jprogramming] sort times

Joey K Tuttle jkt at qued.com
Sat Jul 5 06:39:15 UTC 2014


On 2014/07/04, 22:59 , Roger Hui wrote:
> I have observed a puzzling timing result which may be CPU dependent.
>   Please try the following and tell me what ratio you get, and the kind of
> machine you ran it on.  Thanks.
>
> On my machine, an XPS L521X Intel Core i7-3632QM @ 2.2 GHz,
>
>     x=: 1e6 $ ' '
>     y=: a. {~ ? 1e6 $ 256
>     %/ 100 (6!:2)&> '/:~x' ; '/:~y'
> 2.44133
>
> Basically, sorting a constant vector of 1-byte ints takes 2.4 times as long
> as sorting a random vector of 1-byte ints.

NB. on iMac 2.93 GHz Intel Core i7
    JVERSION
Engine: j701/2011-01-10/11:25 build: Feb  6 2011 16:16:29
Library: 8.01.020
Platform: Darwin 64
Installer: j801 install
InstallPath: /Applications/j64-801
       x=: 1e6 $ ' '
       y=: a. {~ ? 1e6 $ 256
       %/ 100 (6!:2)&> '/:~x' ; '/:~y'
1.12132

jkt at set1:~$ ijconsole
       x=: 1e6 $ ' '
       y=: a. {~ ? 1e6 $ 256
       %/ 100 (6!:2)&> '/:~x' ; '/:~y'
0.999385
    JVERSION
Engine: j701/2011-01-10/11:25
Library: 8.02.10
Platform: Linux 64
Installer: unknown
InstallPath: /usr/share/j/8.0.2
    host 'cat /proc/cpuinfo'
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 30
model name    : Intel(R) Xeon(R) CPU           X3430  @ 2.40GHz
stepping    : 5
microcode    : 0x3
cpu MHz        : 1200.000
cache size    : 8192 KB


NB. On iPhone 5S
       x=: 1e6 $ ' '
       y=: a. {~ ? 1e6 $ 256
       %/ 100 (6!:2)&> '/:~x' ; '/:~y'
1.92691



More information about the Programming mailing list