siddhartha-gadgil / Superficial

Curves and other structures on surfaces (topology)
MIT License
3 stars 13 forks source link

Efficient serialization by avoiding field names #96

Closed siddhartha-gadgil closed 3 years ago

siddhartha-gadgil commented 3 years ago

The problem

Solution

siddhartha-gadgil commented 3 years ago

A related change in terms of code (but with different effect). A slight speedup was obtained by memoizing hashes (which are computed a lot since we use maps and group stuff). This is accomplished by using the following code (from StackOverflow) which memoizes the hash code:

override val hashCode: Int = scala.util.hashing.MurmurHash3.productHash(this)

While writing tuple methods for all the case classes, it will be worth doing this too.