title: Using feed_dict is more than 5x faster than using dataset API?
body: <p>I created a dataset in TFRecord format for testing. Every entry contains 200 columns, named <code>C1</code> - <code>C199</code>, each being a strings list, and a <code>label</code> column to denote the labels. The code to create the data can be found here: <a href="https://github.com/codescv/tf-dist/blob/8bb3c44f55939fc66b3727a730c57887113e899c/src/gen_data.py#L25" rel="noreferrer">https://github.com/codescv/tf-dist/blob/8bb3c44f55939fc66b3727a730c57887113e899c/src/gen_data.py#L25</a></p>
  
  <p>Then I used a linear model to train the data. The first approach looks like this:</p>
  
  <pre><code>dataset = tf.data.TFRecordDataset(data_file)
  dataset = dataset.prefetch(buffer_size=batch_size*10)
  dataset = dataset.map(parse_tfrecord, num_parallel_calls=5)
  dataset = dataset.repeat(num_epochs)
  dataset = dataset.batch(batch_size)
  
  features, labels = dataset.make_one_shot_iterator().get_next()    
  logits = tf.feature_column.linear_model(features=features, feature_columns=columns, cols_to_vars=cols_to_vars)
  train_op = ...
  
  with tf.Session() as sess:
      sess.run(train_op)
  </code></pre>
  
  <p>The full code can be found here: <a href="https://github.com/codescv/tf-dist/blob/master/src/lr_single.py" rel="noreferrer">https://github.com/codescv/tf-dist/blob/master/src/lr_single.py</a></p>
  
  <p>When I run the code above, I get 0.85 steps/sec (batch size being 1024).</p>
  
  <p>In the second approach, I manually get batches from Dataset into python, then feed them to a placeholder, like this:</p>
  
  <pre><code>example = tf.placeholder(dtype=tf.string, shape=[None])
  features = tf.parse_example(example, features=tf.feature_column.make_parse_example_spec(columns+[tf.feature_column.numeric_column('label', dtype=tf.float32, default_value=0)]))
  labels = features.pop('label')
  train_op = ...
  
  dataset = tf.data.TFRecordDataset(data_file).repeat().batch(batch_size)
  next_batch = dataset.make_one_shot_iterator().get_next()
  
  with tf.Session() as sess:
      data_batch = sess.run(next_batch)
      sess.run(train_op, feed_dict={example: data_batch})
  </code></pre>
  
  <p>The full code can be found here: <a href="https://github.com/codescv/tf-dist/blob/master/src/lr_single_feed.py" rel="noreferrer">https://github.com/codescv/tf-dist/blob/master/src/lr_single_feed.py</a></p>
  
  <p>When I run the code above, I get 5 steps/sec. That is 5x faster than the first approach. This is what I do not understand, because theoretically the second should be slower due to the extra serialization/deserialization of data batches.</p>
  
  <p>Thanks!</p>