Help / Phrases / 14. A. Execution Time & Space

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Phrases


14A. Execution Time & Space

v0=: time=: 6!:2 Time to execute y (or avg of x executes)
m1=: space=: 7!:2 Space used to execute y
v2=: ts=: 6!:2, 7!:2@] Time and space

The foregoing phrases may be used to obtain the time and space required to execute a sentence. For example:

   r=: report=: ?3 4 5$10
   r;(/:~r);(/:"1~r)
+-----------------------------+
|6 6 9 3 5|6 4 7 9 7|3 5 6 6 9|
|8 0 0 5 6|2 0 7 3 6|0 0 5 6 8|
|0 3 0 4 6|7 9 3 2 9|0 0 3 4 6|
|5 9 8 5 0|7 7 6 0 6|0 5 5 8 9|
|         |         |         |
|6 4 7 9 7|6 6 9 3 5|4 6 7 7 9|
|2 0 7 3 6|8 0 0 5 6|0 2 3 6 7|
|7 9 3 2 9|0 3 0 4 6|2 3 7 9 9|
|7 7 6 0 6|5 9 8 5 0|0 6 6 7 7|
|         |         |         |
|8 2 4 7 4|8 2 4 7 4|2 4 4 7 8|
|2 2 3 1 4|2 2 3 1 4|1 2 2 3 4|
|8 9 0 9 5|8 9 0 9 5|0 5 8 9 9|
|5 3 9 4 2|5 3 9 4 2|2 3 4 5 9|
+-----------------------------+

   time '/:~r'
0

   100 time '/:~r'
0.0005

   100 time '/:"1~r'
0.0005

   space '/:"1~r'
4160

   100 ts '/:"1~r'
0.0005 4160 



>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Phrases