   alias CSV.Lexer, as: Lexer
   alias CSV.Relay, as: Relay
 
-  @num_pipes 8
+  @num_pipes :erlang.system_info(:schedulers) * 3
 
   @doc """
   Decode a stream of comma-separated lines into a table.

  defp build_producer!(stream, pipes) do
    num_pipes = pipes |> Enum.count

    Stream.transform stream, fn -> 0 end, fn line, index ->
      pipe_index = index |> rem(num_pipes)
      { line_receiver, relay } = pipes |> Enum.fetch!(pipe_index)
      line_receiver |> send({ index, line })

      { [{ relay, index }], index + 1 }
    end, fn index -> 
      pipes |> Enum.each fn { line_receiver, relay } ->
        relay |> send :halt


      iex> File.stream!(\"data.csv\") |>
      iex> CSV.Decoder.decode |>
      iex> Enum.take(2)
      [[\"a\",\"b\",\"c\"], [\"d\",\"e\",\"f\"]]

