On Thu, Sep 19, 2019 at 10:25:20PM -0500, Tim Peters wrote: [...] > Something I haven't seen mentioned here, but I may have missed it: > when timing algorithms with sets and dicts, people often end up merely > measuring the bad effects of hardware data cache misses when the > containers get large, and especially in contrived benchmarks. > > In those the base data tends to get built up in a contiguous range of > memory, and storing the objects in a list leaves traversing the list > fetching the objects' data in the same contiguous memory order. It's > as cache-friendly as can be.
I'm not sure if this is something specific to timing tests, or if it will hold for real-world data in non-contrived code too. If it holds for real data, then presumably it counts as as advantage of lists over sets. But if it is an artifact of naive/contrived timing tests, is there something we can do to make the tests less naive? -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/2MXJADFTXLY2ERQDU5WFD4BYDAF7IB7I/ Code of Conduct: http://python.org/psf/codeofconduct/