Avatar
多分これをやってみるんだろうな。 Set and Dictionary currently use a global random seed; we should perturb that seed with something to eliminate this issue. Simply XORing either the storage address or the capacity to the seed would eliminate the O(n^2) behavior. Per-instance seeding with the storage address is generally a good idea, except in cases where we want repeatable results – in test suites and the like. In those environments, we disable random hash seeding, but these operations should still not regress to quadratic performance. So when a hash seed override is in effect, we should still use the storage capacity as the hash seed. https://bugs.swift.org/browse/SR-3268?focusedCommentId=33436&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-33436