title: How partitions work in spark parallelize?
body: <p>I write following code for Spark:</p>
  
  <pre><code>val longList = 1 to 1000000 toList
  val numsToAdd = sc.parallelize(longList,30)
  val st = System.nanoTime()
  println(numsToAdd.reduce((x,y) =&gt; x+y))
  val et = System.nanoTime()
  println("Time spend:"+(et-st))
  </code></pre>
  
  <p>I perform parallelize transformation with varies values for partitions.
  Time spend is as:</p>
  
  <pre><code> Partitions     Time spend
  
   default        97916961
  
   10             111907094
  
   20             141691820
  
   30             158264230
  </code></pre>
  
  <p>My understanding is that with partitions parameter,spark divides the dataset in that many parts and perform parallel operations on each part. So intuitively, more the partitions faster must be the program.</p>
  
  <p>But it seems its opposite.</p>
  
  <p>I run my program in my local machine.</p>
  
  <p>Do partitions work some other way?</p>