I have extremely large .txt file (around 180 MB in the MathML form). This .txt file contains simplified expression in polynomial form and can not be reduced more. After starting the import process, after two days Mathematica 11 is still working. Is there any solution how to speed up it. Ram memory is 10% used all the time.
Large file is uploading long time (few days and nothing) MathML .txt:
https://www.dropbox.com/s/7ayc1i46bv24823/numerator.txt?dl=0
Small .txt with the same MathML structure is uploading fast (few swconds):
https://www.dropbox.com/s/w5y4tlk15jqbt49/num.txt?dl=0
SetDirectory[NotebookDirectory[]];
imp = Import["num.txt"];
eq = ImportString[imp, "Expression"];
"HeldExpression"
or"InactiveExpression"
. Is it possible that any of the variables in the expression had values assigned to them whenImportString
was run? This would cause Mathematica to substitute those values into the expression and then calculate to resolveeq
. Depending on what they are this could take a while. $\endgroup$ToExpression[ ToString@Expand[(1 + x)^20000], InputForm, HoldComplete ]; // AbsoluteTiming
. The data it produces is ~170 MB. As Edmund said, trystr = Import["num.txt", "String"]; expr = ToExpression[str, InputForm, HoldComplete];
. It can't be the parsing that's slow, it must be the evaluation. Your firstImport
should specify the format. Don't leave it to chance. $\endgroup$