Hello everyone,
I was wondering what is the fastest way to write out a very long expression to a file in a human readable format, lets say InputForm
with ASCII encoding. A suitable benchmark could be
expression = Plus @@ Table[1/n x^n, {n, 1, 2000000}];
or something with more terms. Using AbsoluteTiming
, I see similar performance between Write
and WriteString
. Moreover, it looks like most of the time is spend converting the expression into a string
AbsoluteTiming[exprStr = ToString[expression, InputForm];]
Is this indeed the performance bottleneck, and if so, is there a way how the step can be speeded up?