returnTest.frink

Download or view returnTest.frink in plain text format


/** This is a profiling test to test tight loops which call functions. */

count = million

//input["hit enter."]    // Allow jvisualvm to attach

println["Conditional + return"]
for i = 1 to 10
{
   start = now[]
   for a = 1 to count
      compare[a,500000]
   end = now[]
   println["Frequency is " + count/(end-start)]
}

println["\n\nEnd return with 2 functions"]
for i = 1 to 10
{
   start = now[]
   for a = 1 to count
      uncompare[a,500000]
   end = now[]
   println["Frequency is " + count/(end-start)]
}

compare[a,b] :=
{
   if a < b
      return a
   else
      return b
}  

uncompare[a,b] :=
{
   return min[a,b]
}


Download or view returnTest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19974 days, 1 hours, 45 minutes ago.