-
Notifications
You must be signed in to change notification settings - Fork 79
Improve performance of implicit search #422
Comments
* Add just a memo that will tell us how many times we are looking for the pickler/unpickler of a type `T`.
* Change all the implicit definitions to return `AbstractPicklerUnpickler` instead of `Pickler[T] with Unpickler[T]`. The former one has more precedence than the latter one. This avoids to call the generator macro EVERY TIME we ask for an implicit pickler/unpickler. * Make sure that the `LowPriorityImplicits` are placed in the right location of the `Defaults` trait. * This addresses a big deal of scala#422 although more changes will come, especially affecting `preferringAlternativeImplicits`. * Do some minor cleanup and formatting changes (trying out scalafmt) in the project. * Remove explicit registerings of picklers that were not necessary because of `AutoRegister`. * Register myself to the TODOs that are concerned with the creation of runtime picklers/unpicklers. @jsuereth, I've stolen you some TODOs ;)
Current:
I still have to figure out why My last changes (in my private repo) decrease the compilation time by a half (in my computer the speedup is ~3x). There are still some more improvements coming that will improve |
* Change all the implicit definitions to return `AbstractPicklerUnpickler` instead of `Pickler[T] with Unpickler[T]`. The former one has more precedence than the latter one. This avoids to call the generator macro EVERY TIME we ask for an implicit pickler/unpickler. * Make sure that the `LowPriorityImplicits` are placed in the right location of the `Defaults` trait. * This addresses a big deal of scala#422 although more changes will come, especially affecting `preferringAlternativeImplicits`. * Do some minor cleanup and formatting changes (trying out scalafmt) in the project. * Remove explicit registerings of picklers that were not necessary because of `AutoRegister`. * Register myself to the TODOs that are concerned with the creation of runtime picklers/unpicklers. @jsuereth, I've stolen you some TODOs ;)
It also improves #342. I don't own a MBP, but in my Thinkpad x201 which is about 5 years old, the example in the issue consumes ~2s to compile. I think I could cut it even more with the upcoming changes. |
I'm going to put off the next improvements in the implicit search for the next PR, since it's not high priority. |
* Add just a memo that will tell us how many times we are looking for the pickler/unpickler of a type `T`.
* Change all the implicit definitions to return `AbstractPicklerUnpickler` instead of `Pickler[T] with Unpickler[T]`. The former one has more precedence than the latter one. This avoids to call the generator macro EVERY TIME we ask for an implicit pickler/unpickler. * Make sure that the `LowPriorityImplicits` are placed in the right location of the `Defaults` trait. * This addresses a big deal of scala#422 although more changes will come, especially affecting `preferringAlternativeImplicits`. * Do some minor cleanup and formatting changes (trying out scalafmt) in the project. * Remove explicit registerings of picklers that were not necessary because of `AutoRegister`. * Register myself to the TODOs that are concerned with the creation of runtime picklers/unpicklers. @jsuereth, I've stolen you some TODOs ;)
* Add just a memo that will tell us how many times we are looking for the pickler/unpickler of a type `T`.
* Change all the implicit definitions to return `AbstractPicklerUnpickler` instead of `Pickler[T] with Unpickler[T]`. The former one has more precedence than the latter one. This avoids to call the generator macro EVERY TIME we ask for an implicit pickler/unpickler. * Make sure that the `LowPriorityImplicits` are placed in the right location of the `Defaults` trait. * This addresses a big deal of scala#422 although more changes will come, especially affecting `preferringAlternativeImplicits`. * Do some minor cleanup and formatting changes (trying out scalafmt) in the project. * Remove explicit registerings of picklers that were not necessary because of `AutoRegister`. * Register myself to the TODOs that are concerned with the creation of runtime picklers/unpicklers. @jsuereth, I've stolen you some TODOs ;)
* Add just a memo that will tell us how many times we are looking for the pickler/unpickler of a type `T`.
* Change all the implicit definitions to return `AbstractPicklerUnpickler` instead of `Pickler[T] with Unpickler[T]`. The former one has more precedence than the latter one. This avoids to call the generator macro EVERY TIME we ask for an implicit pickler/unpickler. * Make sure that the `LowPriorityImplicits` are placed in the right location of the `Defaults` trait. * This addresses a big deal of scala#422 although more changes will come, especially affecting `preferringAlternativeImplicits`. * Do some minor cleanup and formatting changes (trying out scalafmt) in the project. * Remove explicit registerings of picklers that were not necessary because of `AutoRegister`. * Register myself to the TODOs that are concerned with the creation of runtime picklers/unpicklers. @jsuereth, I've stolen you some TODOs ;)
These are the times we are looking for an implicit of type
T
in the implicit search for our test suite (which, btw, is huge):These stats lay the ground for the upcoming improvement in the implicit search that hopefully will address the performance issues that we face right now, especially large compilation times. I think that there's room for improvement and I'm working tirelessly on it.
The text was updated successfully, but these errors were encountered: