Context and memory usage savings

Posts   
 
    
tmatelich
User
Posts: 95
Joined: 14-Oct-2009
# Posted on: 08-Jul-2013 21:12:33   

LLBLGen v4.

I'm adding a new join in my system, and the entities being joined will likely overlap with some that are already joined, so I'm looking at Context to avoid unnecessary memory usage.

I have current reports and history reports, classified by widget. I retrieve all relevant history reports (incrementally, per widget in the background). I also use a prefetch path to load the history reports that are directly related to the current widgets via an m:n relationship to a join table. I will be adding a similar join table but I will be prefetching the history entity into the join entity. With my current schema, I'd load each history entity 1 or 2 times, but when I add the new joins that may balloon to 20 copies.

So, would you verify that if I used a application-scope context for loading my current and history reports that I will only maintain one instance of the history entities?

From reading the documentation, it sounds like when I incrementally background load the history reports that I'll need to feed them through the context on the main thread. Is that correct? Is there any way around that?

Now that I have this all written out, I'm realizing that it probably would make more sense for me to stop using the prefetch and manually link to the history entities I've already retrieved, especially since I know they're immutable.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 09-Jul-2013 00:48:05   

Now that I have this all written out, I'm realizing that it probably would make more sense for me to stop using the prefetch and manually link to the history entities I've already retrieved, especially since I know they're immutable.

Makes perfect sense.