Whatever message this page gives is out now! Go check it out!

ArrayMin

Last update:
May 18, 2026
Note:
You can also set the maximum thread count in ColdFusion Administrator. Click Server Settings > Settings and specify the number of threads in Default Maximum Thread Count For Parallel Functions .

Description

Array minimum function.

Returns

The smallest numeric value in an array. If the array parameter value is an empty array, returns zero.

Category

HISTORY
ColdFusion (2021 release): Introduced the following parameters:
  • parallel
  • maxThreadCount

syntax

arrayMin(array [, parallel] [, maxThreadCount])

Parameters

Parameter
Description
array
Name of an array
parallel
True if you want to enable parallel programming.
maxThreadCount
The number of threads the function can execute. The number of threads must be between 1-50. If the value exceeds 50, there is an exception.

Example

<cfscript>
       myArray=[23,76,1,-43,9,112]
       minVal=ArrayMin(myArray)
       WriteOutput(minVal)// Returns -43
</cfscript>

Using parallelization

<cfscript> 
 for(i=1;i<=1001;i++){ 
  arr[i] = i*2; 
  if(i == 554) 
   arr[i]= -2147483648  
 } 
 //writedump(arr) 
 //writeoutput(arr.min()) 
  
 t_start=GetTickCount() 
writeoutput(arraymin(arr,true,5))  
 t_end=GetTickCount() 
 writeoutput("<br>Time taken with 5 threads:" &  t_end-t_start) 
  
  
 t_start=GetTickCount() 
writeoutput(arr.min(true,10)) 
 t_end=GetTickCount() 
 writeoutput("<br>Time taken with 10 threads:" &  t_end-t_start) 
  
 t_start=GetTickCount() 
writeoutput(arraymin(array=arr,parallel=true,maxthreadcount=20)) 
 t_end=GetTickCount() 
 writeoutput("<br>Time taken with 20 threads:" &  t_end-t_start) 
  
 t_start=GetTickCount() 
writeoutput(arr.min()) 
 t_end=GetTickCount() 
 writeoutput("<br>Time taken with no parallel:" &  t_end-t_start) 
  
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page