You can use $PrePrint
and Replace
with either ToString
or CanonicalName
.
Before setting $PrePrint
SessionTime[];
ConstantArray[Entity["Country", "Bermuda"], 10000]
SessionTime[] - Out[-2]
takes 1.0735404 seconds to render the 10,000 entity objects.
I use Interpretation
to ensure the reformatted entities can still used. Pane
provides formatting and spacing when reformatted entities are used in input.
With ToString
$PrePrint =
Replace[#
, e_Entity :>
Interpretation[Pane[ToString[e], ContentPadding -> False], e]
, Infinity
] & ;
Now
SessionTime[];
ConstantArray[Entity["Country", "Canada"], 10000]
SessionTime[] - Out[-2]
takes 0.1586101 seconds to render the 10,000 reformatted entity objects.
These objects can still be used as entities and even copied and pasted as input.
With CanonicalName
it is slightly faster that ToString
.
$PrePrint =
Replace[#
, e_Entity :>
Interpretation[Pane[CanonicalName[e], ContentPadding -> False], e]
, Infinity
] &;
then
SessionTime[];
ConstantArray[Entity["Country", "Nigeria"], 10000]
SessionTime[] - Out[-2]
takes 0.1426487 seconds to render the 10,000 reformatted entity objects.
Still can be used for input
$PrePrint
can be cleared with
$PrePrint =.
Hope this helps.