Skip to main content
added 72 characters in body
Source Link
chyanog
  • 15.8k
  • 3
  • 41
  • 83
$Version
e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

"11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test3.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}

e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test3.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}

$Version
e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

"11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test3.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}

edited body
Source Link
chyanog
  • 15.8k
  • 3
  • 41
  • 83
e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test4Export["test3.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}

e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test4.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}

e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test3.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}

Source Link
chyanog
  • 15.8k
  • 3
  • 41
  • 83

e = RandomReal[{-10, 10}, {1000, 1000}];
Export["test1.txt", e, "Table"] // AbsoluteTiming

{51.09841768091894, "test1.txt"}

colsep = "\t";
rowsep = "\n";
prec = 16;
SetAttributes[doubletostring, Listable];
doubletostring[x_] := Internal`DoubleToString[x, False, prec];
Export["test2.txt", 
  StringJoin[
   Map[row \[Function] 
     StringJoin[Riffle[doubletostring /@ row, colsep], rowsep], 
    e]]] // AbsoluteTiming

{13.71278727644397, "test2.txt"}

Export["test4.txt", 
  e // Map[Row[#, "\t"] &] // Column // 
    NumberForm[#, 16, ExponentFunction -> (Null &)] & // ToString] // AbsoluteTiming

{2.621917257541675, "test3.txt"}