Skip to content

Commit

Permalink
B-tree map
Browse files Browse the repository at this point in the history
  • Loading branch information
ka-weihe authored and medvednikov committed Dec 30, 2019
1 parent 2d2e030 commit 8a4bce6
Show file tree
Hide file tree
Showing 2 changed files with 346 additions and 189 deletions.
Loading

2 comments on commit 8a4bce6

@dumblob
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ka-weihe could you maybe randomize iteration (Go randomizes it as well) by default to avoid

  1. wrong programmer assumptions immediately
  2. avoid easy attack vectors like Exposure of HashMap iteration order allows for O(n²) blowup. rust-lang/rust#36481 (potential solution to some)

There should be also a deterministic variant (guaranteeing iteration in insertion order) - e.g. OrderedMap, but it must not be the default map.

See also my comment #2209 (comment) .

@ka-weihe
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my understanding, that problem is regarding hashmaps. In fact, he (rust-lang/rust#36481) proposed a solution where they fallback to a B-tree map to solve this problem, so it shouldn't be a problem with this map. I will keep it in mind for the hashmap I'm creating.

Please sign in to comment.