title: How to speed up split(string) in spark
body: <p>I have a large dataset(480k+ records) on HDFS and i want to split each record by \t.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>static JavaPairRDD&lt;String, String&gt; load(JavaSparkContext sc, String path) throws Exception {
      JavaRDD&lt;String&gt; wholeData = sc.textFile(path);
      JavaPairRDD&lt;String, String&gt; wholeDataRDD = wholeData.mapToPair(new PairFunction&lt;String, String, String&gt;() {
          public Tuple2&lt;String, String&gt; call(String s) throws Exception {
              List&lt;String&gt; line = Arrays.asList(Pattern.compile("\t").split(s));
              return new Tuple2&lt;String, String&gt;(line.get(0), line.get(1));
          }
      });
      return wholeDataRDD;
  }
  </code></pre>
  
  <p>The above code can work but it is too slow(about 9min).</p>
  
  <p>Thanks for any advice</p>