Add GenBool instance for Map[K, V: GenBool].#126
Conversation
There was a problem hiding this comment.
for performance you might want:
(a.keySet intersect b.keySet).iterator
.map { k => (k, GBV.and(a(k), b(k))) }
.filter { case (_, v) => EqV.neqv(GBV.zero, v) }
.toMapputting the iterator early prevents materialization after .map and .filter. Also, note, .map is returning a set here and so if filter, so that is going to be bit slower than the iterator.
|
I realize we didn't add Also, there are many similar constructions related to |
|
I will rewrite the expressions to invoke |
|
Yeah, I realized there could be interesting structures for |
|
I don't know how immutable m log n < n + m it is more efficient to update the big map. |
|
Immutable map is a HashTrie, so it is ~ |
|
@TomasMikula you might want to take a look at: https://github.com/non/algebra/blob/a32f76aba93245b95972b4b4bb80f29b0621c9ba/std/src/main/scala/algebra/std/Util.scala#L154 the addMap/subtractMap methods may be able to be used in these cases. |
|
Yeah, |
- Optimize chains of map/filter by invoking iterator early. - Use tuple pattern matching on function argument.
|
i think we need the |
I'm afraid you're right.
Indeed, it would make sense to add |
|
That sounds like a great plan to me! |
No description provided.