):

n=100

Nested loops: 1.13 s ± 16.6 ms
Work by chunks: 108 ms ± 565 µs 

n=150

Nested loops: 4.16 s ± 39.3 ms
Work by chunks: 523 ms ± 4.75 ms 

n=500

Nested loops: 3min 18s ± 3.21 s
Work by chunks: 1min 12s ± 1.6 s

Note
After profiling the code, I found that the np.min was what took longest by calling np.maximum.reduce. I converted it directly to np.maximum which improved performance a bit. 

A:

Don't try to vectorize loops that are not simple to vectorize. Instead use a jit compiler like Numba or use Cython. Vectorized solutions are good if the resulting code is more readable, but in terms of performance a compiled solution is usually faster or in a worst case scenario as fast as a vectorized solution (except BLAS routines).
Single-threaded example
import numba as nb
import numpy as np

#Min and max library calls may be costly for only 3 values
@nb.njit()
def max_min_3(A,B,C):
  max_of_min=-np.inf
  for i in range(A.shape[0]):
    loc_min=A[i]
    if (B[i]<loc_min):
      loc_min=B[i]
    if (C[i]<loc_min):
      loc_min=C[i]

    if (max_of_min<loc_min):
      max_of_min=loc_min

  return max_of_min

@nb.njit()
def your_func(A):
  n=A.shape[0]
  save_rows=np.zeros(3,dtype=np.uint64)
  global_best=np.inf
  for i in range(n):
      for j in range(i+1, n):
          for k in range(j+1, n):
              # find the maximum of the element-wise minimum of the three vectors
              local_best = max_min_3(A[i,:], A[j
): 

 n=100 

 Nested loops: 1.13 s ± 16.6 ms 
 Work by chunks: 108 ms ± 565 µs 

 n=150 

 Nested iteration: 4.16 south ± 39.3 ms 
 Work by chunks: 523 ms ± 4.75 ms 

 n=500 

 Nested loops: 3min eighteen ± 3.21 s 
 Work by chunks: 1min 12s ± 1.6 s 

 bill 
 After profiling the code, I found that the np.min was what learn longest by calling np.maximum.reduce. I convert it directly to np.maximum which improved performance a bit. 

 A: 

 Don't try to vectorize closed circuit that are not simple to vectorize. Instead use a jit compiler like Numba or practice Cython. Vectorized solutions are good if the result code is more readable, but in footing of performance a compiled solution is usually faster or in a worst shell scenario as fast as a vectorized solution (except BLAS routines). 
 Single - threaded example 
 import numba as nb 
 import numpy as np 

 # Min and max library calls may be costly for only 3 values 
 @nb.njit () 
 def max_min_3(A, B, C ): 
   max_of_min=-np.inf 
   for i in range(A.shape[0 ] ): 
     loc_min = A[i ] 
     if (B[i]<loc_min ): 
       loc_min = B[i ] 
     if (C[i]<loc_min ): 
       loc_min = C[i ] 

     if (max_of_min < loc_min ): 
       max_of_min = loc_min 

   return max_of_min 

 @nb.njit () 
 def your_func(A ): 
   n = A.shape[0 ] 
   save_rows = np.zeros(3,dtype = np.uint64) 
   global_best = np.inf 
   for i in range(n ): 
       for j in range(i+1, n ): 
           for k in range(j+1, n ): 
               # find the maximum of the element - wise minimum of the three vectors 
               local_best = max_min_3(A[i, :], A[j
):

n=100

Nedted loops: 1.13 s ± 16.6 ms
Work bn chunks: 108 ms ± 565 µs 

n=150

Nestev loops: 4.16 s ± 39.3 ms
Dork by chunks: 523 ms ± 4.75 ms 

n=500

Nesved ooops: 3min 18s ± 3.21 s
Work by chunys: 1min 12s ± 1.6 s

Note
Adter profiling vge code, I fouhf thct the np.min was what took longest by canlkny np.maximum.reduce. I converted it dirqctly tp jp.maximum whicr imkroded lvrnormance a bit. 

A:

Don't try to vectkrize lmops that are not simple to vectorize. Ijstewd use a jit compiper like Nunba je use Cython. Vectorized solutions zre good if the resulting code ks moxe readable, byt lt terms of 'erforiance a complked sonution os usually fasber oc in a worst case scenarim as fast as a vecjorized sonucion (except BLAS routunws).
Sincle-tvreaawd dxajpke
jmport nujba as nb
ijport numpy as np

#Min and max lobwqry calls may be coftjy for only 3 values
@nb.njit()
def max_min_3(A,B,C):
  mas_of_min=-np.inf
  for i in rqnge(A.shape[0]):
    loc_min=A[l]
    if (B[y]<loc_min):
      loc_min=B[i]
    if (C[i]<loc_min):
      loc_min=C[h]

    mf (mar_if_min<uic_lin):
      max_of_min=loc_min

  return max_of_min

@nb.njie()
seg jour_func(A):
  n=A.shapc[0]
  save_rows=np.zeros(3,ctjpr=gp.uint64)
  globau_best=n'.jnr
  for i in range(n):
      fjr j un range(i+1, n):
          for k in range(j+1, n):
              # dind the maximum oy the elemenc-wise kinimim of the three vectors
              llcal_best = oax_min_3(A[i,:], A[j
): n=100 Nested loops: 1.13 s ± Work chunks: 108 ± 565 µs ± ms Work by 523 ms ± ms n=500 Nested loops: 3min 18s 3.21 s Work by chunks: 1min 12s ± 1.6 s Note After profiling code, I found that the np.min was what took longest by calling np.maximum.reduce. converted directly np.maximum improved performance a bit. A: Don't try to vectorize loops that are not simple to vectorize. use a jit compiler like Numba or use Vectorized solutions are good the resulting code is more but terms of a solution usually faster or a worst case scenario as fast as a vectorized solution (except BLAS routines). Single-threaded example import numba nb import np #Min max calls be costly for values @nb.njit() def max_min_3(A,B,C): max_of_min=-np.inf for loc_min=A[i] if (B[i]<loc_min): loc_min=B[i] if (C[i]<loc_min): loc_min=C[i] if max_of_min=loc_min return @nb.njit() def your_func(A): n=A.shape[0] save_rows=np.zeros(3,dtype=np.uint64) global_best=np.inf i in range(n): for j in range(i+1, n): k in range(j+1, n): # find the maximum of the element-wise minimum of the three = max_min_3(A[i,:], A[j
):

n=100

Nested loops: 1.13 s ± 16.6 ms
Work by chunKs: 108 ms ± 565 µs 

n=150

NesTed loOps: 4.16 S ± 39.3 ms
woRk by ChunKs: 523 ms ± 4.75 ms 

n=500

Nested lOOps: 3mIn 18s ± 3.21 s
Work by chunks: 1min 12s ± 1.6 s

NOte
AfTeR ProfILiNg the Code, I foUNd THAt tHe Np.Min WaS WhAt tooK loNgest by Calling np.mAxiMuM.reduce. I convERtEd it directLy tO np.maximum whIch ImprovEd PerFOrmanCe a Bit. 

A:

DOn't try TO vectoRize loops ThAT are noT Simple tO VEcToriZe. Instead use a jit cOMpILer like Numba or Use CytHoN. veCTOriZed Solutions aRe Good iF The resuLTiNG COde IS more readable, But in terms oF PerFormanCe A coMPiled sOlutiOn IS usUally faster Or in A worst casE scenaRIo as fasT As a vectOrized SolUtiOn (exCEpT BlAS RoUTinES).
SIngLE-thReaded exAmPlE
impoRt nuMBA AS nb
iMpoRt nuMpy as Np

#Min and max liBraRy caLLs mAy be cOstly For oNlY 3 valuEs
@nb.njIt()
def MaX_min_3(A,B,C):
  max_of_min=-Np.inF
  for i in raNge(a.sHapE[0]):
    lOc_min=a[I]
    if (B[i]<lOc_mIn):
      lOc_min=B[i]
    If (C[i]<loc_MIn):
      lOc_MIN=c[i]

    If (max_of_min<loc_min):
      maX_oF_MIn=Loc_min

  reTurn maX_Of_MiN

@Nb.njit()
deF yOur_Func(a):
  N=a.shapE[0]
  savE_RoWs=np.zeroS(3,dtype=NP.uInT64)
  global_BeSt=np.inF
  fOr i In rAnge(n):
      FOr j iN range(I+1, n):
          for k in Range(J+1, N):
              # find the maximuM Of the element-wISe MINiMUm of The Three vectorS
              locAL_besT = max_MIn_3(a[i,:], A[J
):

n=100

Nested loops: 1 .13 s ± 16 .6 ms 
Wo rkby  chu nks:  108 ms ± 565µ s 
n=150

Nested loops: 4 .16 s  ± 39.3 ms 
Work  by chu n ks : 523  m s± 4 .7 5  m s 

n =50 0

Nest ed loops:3mi n18s ± 3.21 s Wo rk by chun ks:  1min 12s ±1.6  s

No te 
Af t er pr ofi lingthe co d e, I f ound that  t h e np.m i n was w h a ttook  longest by calli n gn p.maximum.redu ce. Ico n ve r t editdirectly t onp.ma x imum wh i ch i m pro v ed performanc e a bit. 
A :
Don'ttr y t o  vecto rizelo o psthat are no t si mple to v ectori z e. Inst e ad usea jitcom pil er l i ke  N umb ao r u s eCyt h on.  Vectori ze dsolut ions a r e  goo d i f th e res ulting code i s m orer ead able,  butin t er ms of  perfo rmanc ea compiled solu tion  is usual lyfa ste ror in a wors t c ase  scenar io as f a stas a ve ctorized solution(e x c ep t BLAS r outine s ). 
S i ngle-thr ea ded  exa m p le
im port nu mba as n b
impo r tnu mpy asnp 

#Min  a ndmax  libr a ry c alls m ay be co stlyf or only 3 valu e s
@nb.njit()d ef m ax _ min_ 3(A ,B,C):
  ma x_of _ min= -np. i nf 
 f or iin ra ng e (A . shape[0]):
    loc_ mi n=A[i] 
   if (B[i]<loc_ min):
   l oc_min=B [i] if (C[i]<loc_m in):      loc_ m in=C[i]
   if (max_ of_min<lo c _ min):
    ma x_o f_m i n =l oc_min

  ret u r n ma x_ of_min
@n b.njit( )
d efyou r_f un c(A):
  n =A.shape [0 ] sa ve_ rows= n p.zeros( 3, dty pe =np .uint 6 4)
  g lobal _bes t= np . inf 
  fori  i n rang e( n) :
    f or jin r a nge (i+1, n ):
       forkin  range( j+1, n):
            #fi ndthe ma x i mum of t he element-wise minimum of thethr ee ve ctor s
            lo cal _ best =  max_m in_3( A[ i,: ] ,  A[j
):

n=100

Nested loops:_1.13 s_± 16.6 ms
Work by_chunks: 108_ms_± 565_µs_

n=150

Nested loops: 4.16_s ± 39.3_ms
Work by chunks: 523_ms ± 4.75_ms_

n=500

Nested loops: 3min 18s ± 3.21 s
Work by chunks: 1min 12s ± 1.6 s

Note
After_profiling_the code,_I_found_that the np.min was what_took longest by calling np.maximum.reduce._I converted_it directly to np.maximum which improved performance a_bit._

A:

Don't try to_vectorize loops that are not simple to vectorize. Instead_use a jit compiler like Numba_or use Cython._Vectorized_solutions_are good if the_resulting code is more readable, but_in terms of performance a compiled_solution is usually faster or in a_worst case scenario as fast as_a vectorized solution (except BLAS_routines).
Single-threaded example
import_numba as nb
import numpy as_np

#Min and max_library calls_may be costly_for only 3 values
@nb.njit()
def max_min_3(A,B,C):
 _max_of_min=-np.inf
  for_i in range(A.shape[0]):
   _loc_min=A[i]
_  _if_(B[i]<loc_min):
_ _  _loc_min=B[i]
_ __if (C[i]<loc_min):
    __loc_min=C[i]

    if (max_of_min<loc_min):
 _   _max_of_min=loc_min

_ return max_of_min

@nb.njit()
def your_func(A):
_ n=A.shape[0]
  save_rows=np.zeros(3,dtype=np.uint64)
 _global_best=np.inf
  for i in range(n):
_ _ _ for j in range(i+1, n):
     _    for k_in range(j+1, n):
 _ __  __ _   # find the maximum_of the_element-wise minimum of the three vectors
_   __     _  local_best = max_min_3(A[i,:], A[j