Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store class names instead of classes in acts_as_ registries
Storing classes in development may lead to problems when reloading classes, as new versions of the class will be appended to the list, but `instance` method will still find the old versions of the classes. I considered adding caching for production environment, but additional code is not justified by 3 times faster execution. ```ruby require "benchmark/ips" h = {"Project" => Project} Benchmark.ips do |x| x.report("constantize") { "Project".constantize } x.report("hash access") { h["Project"] } x.compare! end ``` ``` Warming up -------------------------------------- constantize 1.163M i/100ms hash access 3.397M i/100ms Calculating ------------------------------------- constantize 11.842M (± 1.5%) i/s - 59.291M in 5.007752s hash access 34.379M (± 1.3%) i/s - 173.239M in 5.039989s Comparison: hash access: 34378546.0 i/s constantize: 11842325.0 i/s - 2.90x slower ```
- Loading branch information