logoalt Hacker News

glouwbug • today at 5:05 PM • 2 replies • view on HN

True, but moving from a list of unique polymorphic pointers to a std::variant gains you at least a 2-3x speed up in terms of TLB and cacheline locality. From there, swapping to SOA will net you another 4-8x, so you're looking at nearly 25x improvement by going data first. That may not matter in the unique case of say, games, where rendering a million entities will dwarf the cost of SIMD processing a million entities, but in something like numerical simulations (fluids) or quant it will be warmly welcomed


Replies

cenamus • today at 5:16 PM

Is the improvement from using std:variant vs polymorphism just due to the indirection you save on?

➕ show 1 reply