activeldap/activeldap — pull request #26 by mihu (2011-12-25 21:32:21+00:00)
Title: dirty - speed fix

This push us back to using method_missing all the time, but is
still quicker than defining all attribute methods when record
is loaded

Testing with same benchmark, but with 1000 repeat, now shows before the attribute_method patch
``` user system total real
search 0.730000 0.100000 0.830000 ( 1.091821)
init 3.320000 0.110000 3.430000 ( 3.748452)
```
after the attribute_methods and speed fix
``` user system total real
search 0.680000 0.110000 0.790000 ( 1.064839)
init 4.840000 0.100000 4.940000 ( 5.276745)
```
So still slower, but not that much.

When removing Dirty from the mix, times goes down a little bit
``` user system total real
search 0.720000 0.100000 0.820000 ( 1.089593)
init 4.340000 0.110000 4.450000 ( 4.761110)
```

IMHO the initialization of attributes loaded from ldap server has to go trough a lot of (unnecessary) code.

It would be better to define some of the attribute methods when ldap_mapping is called and leave the rest for method_missing. But unfortunatelly at that time there is no garantee that "connection" will be present to get the attributes of specified classes. I will have to look how ActiveRecord is dealing with this.