Curated datasets underwent a significant overhaul in version 10, primarily in the way content is delivered in the form of Objects and Entities. Additionally, it appears that this change in content delivery has also brought about a considerable decrease in performance. Consider the following:
ChemicalData[All, "Preload"]
MapThread[ElementData[#1, #2] &, Transpose@
Tuples@{Range@112, {"Symbol", "Group"}}]; // AbsoluteTiming
MapThread[ElementData[#1, #2] &, Transpose@
Tuples@{Range@112, {"Symbol", "DiscoveryYear"}}]; // AbsoluteTiming
The results from my system (Windows 7 64 bit) are {0.24, 0.16} seconds for version 10 and {0.04, 0.02} for version 9. My original hypothesis was the Head
change in v10; however that does not seem to be the case since:
Head /@ Flatten@Outer[ElementData, {1},
{"Symbol", "Group", "DiscoveryYear"}]
yields {String, Integer, DateObject}
in v10 and {String, Integer, Integer}
in v9; if the change in Head was the cause, we wouldn't expect slowdowns in both of the calls above.
The performance difference really shines in this next example:
out = ChemicalData["Hydrocarbons"];
If[$VersionNumber == 10.,
QuantityMagnitude /@ Through[out[[30 ;; 40]]["BoilingPoint"]],
Outer[ChemicalData, out[[30 ;; 40]], {"BoilingPoint"}] // Flatten] // AbsoluteTiming
I may be comparing apples to oranges here, but I couldn't come up with a single command that would handle the different Head types that are returned in v9 and v10; I'm assuming Through
and Outer
are similarly fast. In any case, they certainly couldn't account for the difference in timing; I get 6.44 seconds for v10 and 0.002 for v9.
Most of the bottleneck in this last example is due to my horrendously slow internet speed; however, it seems preloading the curated data, as suggested here apparently no longer applies in v10. If I turn the internet off with
$AllowInternet = False
The ChemicalData
example returns errors in v10 and is unaffected in v9. Apparently, EntityValue
s used in v10 require an internet connection.
So from this information one can conclude that internet connectivity is one part of the performance issue in v10 curated data calls and leads to the question: How do we access curated data off line with v10? The data have been stored on my computer, I see them in "Location"/.PacletInformation["ElementData"]
, but something else that is occurring while processing these data requires the internet, and I'm at a loss as to how one debugs this issue further.
Internet connectivity is only part of the solution; however, since the ElementData
example is unaffected by $AllowInternet = False
in both v9 and v10. The second part of the question is then: what is v10 doing to make a no-internet-required curated data call 10 times slower than in v9?