unikent/programmes-plant — pull request #258 by thybag (2013-02-21 20:46:19+00:00)
Title: Improve cache generation speeds.

Switch from using eloquents helper methods to direct accesses when generating API's.

This should be significantly faster as it bypasses the slightly slow but friendly interface normally provided and instead uses the internals that laravel thankfully also makes public. This allows us to make assumptions about how and where data is stored rather than forcing eloquent to try and guess every time.

Key changes:
* Reference vars directly from relations or attributes depending on data type.
* Make simple data items dump their internal attributes array rather than proccessing the to_array method.

Below times measured with xdebug using a completely cold cache to load a programme instance.

Before changes:
9406 ms
9344 ms
9358 ms

After changes:
4192 ms
4038 ms
4194 ms