3
$\begingroup$

With the following definition:

col = "num\n" <> StringRiffle[Table[i, {i, 1000}], "\n"];

I do not understand why the "Number" format is two orders of magnitude slower than the others:

Table[
    Timing[
        SemanticImportString[
            col, <|"num" -> format|>
        ];
    ],
    {format, {"Integer", Automatic, "Number"}}
]

(* {{0.03125, Null}, {0.046875, Null}, {4.70313, Null}} *)
$\endgroup$
  • 4
    $\begingroup$ I suspect that the "Number" format has to run through a lot more possible interpretations for the same input than the "Integer" format. As for Automatic, the "Possible Issues" section of the docs for SemanticImportString say that "Automatic type selection chooses from a smaller set of interpretations rather than specifying a type explicitly", so perhaps once again a reduced number of choices makes the process significantly faster. $\endgroup$ – MarcoB Feb 26 '17 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.