Skip to content

Instantly share code, notes, and snippets.

@tueda
Created February 18, 2015 13:28
Show Gist options
  • Select an option

  • Save tueda/17b8afa74cfef27efe6a to your computer and use it in GitHub Desktop.

Select an option

Save tueda/17b8afa74cfef27efe6a to your computer and use it in GitHub Desktop.
#-
#define oldt "0.0"
#procedure time(str)
#message `str'
#system bc <<< `time_'-`oldt'
#redefine oldt "`time_'"
#endprocedure
#define M "3000"
#define T "500"
#define N "14"
#define R "10"
CF Z;
S n1,...,n`N';
L F =
#do i=1,`M'
+ Z(random_(`R')
#do j=2,`N'
,random_(`R')
#enddo
)
#enddo
;
#procedure Test1()
#do i=1,`T'
id Z(n1?,...,n`N'?) = Z(n5,n2,n3,n4,n1,n6,...,n`N');
#enddo
#endprocedure
#procedure Test2()
#do i=1,`T'
id Z(n1?,...,n5?,?nn) = Z(n5,n2,n3,n4,n1,?nn);
#enddo
#endprocedure
.sort
#call time(init)
#call Test1()
.sort
#call time(Test1)
#call Test2()
.sort
#call time(Test2)
* Test2 is faster than Test1.
*
* Use an argument field wildcard instead of wildcards for all arguments if
* possible.
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment