<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Hi Graham,<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Thanks for looking into this! <br><br>We did a little more brainstorming, and figured out another solution: the problematic data is being loaded from DB as the user logs in (and sees a different page), so that when they get to that page, the data will be available. It's already in production, the speed up is quite evident.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Clearly it's a bit of kicking can down road, but we're planning a more proper, comprehensive solution, involving loading data more granularly, as it were.This will require a fairly major re-factor. It'll be needed as we add a dashboard, which will require lots more data.<br>So, for now, being pragmatic, etc. I was hoping to disentangle some of the activerecord magic, but not this time, it seems.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Having said that, if you like, very happy to share the entire files as gists - let me know.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Thanks everyone again!<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Cheers,<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Marco<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"> <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 16 December 2015 at 13:50, Graham Ashton <span dir="ltr"><<a href="mailto:graham@effectif.com" target="_blank">graham@effectif.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, 15 Dec 2015, at 12:37 PM, Marco Iannone wrote:<br>
><br>
> Here are the gists of the responsebuilder<br>
</span>> <<a href="https://gist.github.com/marcoi/c96fb66383147d096cf8" rel="noreferrer" target="_blank">https://gist.github.com/marcoi/c96fb66383147d096cf8</a>>and feedbuilder<br>
> <<a href="https://gist.github.com/marcoi/f0202a8710700e924db2" rel="noreferrer" target="_blank">https://gist.github.com/marcoi/f0202a8710700e924db2</a>>(unnecessary stuff<br>
<span class="">> removed). As I was mentioning the former is used everywhere, the latter<br>
> just here. We can build a bespoke builder.<br>
<br>
</span>Hi Marco. `ResponseBuilder` clearly doesn’t do much, so from here onwards let’s ignore it.<br>
<br>
If I’ve understood it correctly, only `FeedBuilder` cares what “shape” the `feeds_data` object is.<br>
<br>
I wanted to see what `FeedBuilder` actually did with `feeds_data` (i.e. the object encapsulating the ActiveRecord query that you’re trying to optimise), but the gist for `FeedBuilder` doesn’t seem to contain those bits.<br>
<br>
I noticed the call to `.data_object_name`, Googled it, and it looks like you’re using Reevoo’s responsible gem to serialize stuff to JSON?<br>
<br>
<a href="https://github.com/reevoo/responsible" rel="noreferrer" target="_blank">https://github.com/reevoo/responsible</a><br>
<br>
It seems from the README that (to know what `FeedBuilder` is doing with the `feeds_data` variable, and therefore how you could reimplement it to use different objects generated from quicker queries) we'd need to see references (in `FeedBuilder`) to `__data__`.<br>
<br>
We’d also need to see the full list of properties (some of them might be delegated directly through to methods on `FeedDetail`, when the properties are defined).<br>
<br>
Unless there’s private data in it, I’d suggest you post the whole file. Can you share some of the JSON you want to produce as well?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
Graham Ashton (Founder, Agile Planner)<br>
<a href="https://www.agileplannerapp.com" rel="noreferrer" target="_blank">https://www.agileplannerapp.com</a> | @grahamashton | @agileplanner<br>
_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</div></div></blockquote></div><br></div>