derivation_examples
derivation_examples copied to clipboard
An idea to increase the performance of the toMap funtion even more.
I saw you using the mutable maps in the presentation and i was wondering if it was possible to make an immutable map macro that would be even faster then the mutable map building.
In the case of toMap typeclass couldn't the inline macro 'pre-hash' the already known String keys and thus push performance above the level of mutable code and 'sane handwritten code'.
Book(authoer: String, isbn: Long)
val book = Book("author", 12345L)
Mapper.toMap(book)
//inlined 'macro'
{ Map("author" -> book.author, "isbn" -> book.isbn) } // i.e. author and isbn are always the same couldn't the hashing be done at compile time.