Ignore:
Timestamp:
Oct 8, 2009, 2:30:00 PM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1374: Caching of experimental factors

The cache is now working. #1400, #1401 and some other enhancements indicate that the initial caching can be 2-3 times quicker than the old code. The performance gain with the cache seems to be about 5-7 times. The end result is about 15-20 times quicker than the old code. Note that this was for a very simple experiment with 4 raw data sets and 5 experimental factors and almost no other data in the database. This should be tested in real-world scenario.

IMPORTANT NOTE!! Cache invalidation has not yet been implemented. What goes into the cache stays in the cache. Updates and changes to annotations will not be visible!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/views/experiments/view_experiment.jsp

    r5117 r5120  
    5757  import="net.sf.basedb.clients.web.util.HTML"
    5858  import="net.sf.basedb.util.Values"
     59  import="net.sf.basedb.core.snapshot.SnapshotManager"
     60  import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot"
     61  import="net.sf.basedb.core.snapshot.AnnotationSnapshot"
    5962  import="net.sf.basedb.util.formatter.Formatter"
    6063  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     
    545548      else
    546549      {
     550        long time = 0;
    547551        %>
    548552        <base:section
     
    582586          <tbl:rows>
    583587          <%
     588          time -= System.currentTimeMillis();
     589          SnapshotManager manager = new SnapshotManager();
    584590          for (RawBioAssay item : rawBioAssays)
    585591          {
     592            //System.out.println("processing rba: " + item);
    586593            AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null;
     594            //System.out.println("got annotation set: " + as);
     595            AnnotationSetSnapshot snapshot = as == null ? null : manager.getSnapshot(dc, as.getId());
     596            //System.out.println("got snapshot: " + snapshot);
    587597            %>
    588598            <tbl:row>
     
    600610               
    601611                String value = "<i>- none -</i>";
    602                 List<Annotation> all = as == null ? null : as.findAnnotations(dc, at, true);
     612                //System.out.println("load annotations: " + at);
     613                List<AnnotationSnapshot> all = snapshot == null ?
     614                    null : manager.findAnnotations(dc, snapshot, at, true);
     615                //System.out.println("loaded annotations: " + at);
    603616                Map<Annotatable, List> factorValues = new HashMap<Annotatable, List>();
    604617                if (all != null && all.size() > 0)
    605618                {
    606                   for (Annotation a : all)
     619                  for (AnnotationSnapshot a : all)
    607620                  {
    608621                    List values = a.getValues();
     
    612625                    try
    613626                    {
    614                       aItem = a.getAnnotationSet().getItem();
     627                      //System.out.println("load item: "+ a.getItemType() + a.getItemId());
     628                      aItem = a.getItem(dc);
     629                      //System.out.println("loaded item: "+ a.getItemType() + a.getItemId());
    615630                    }
    616631                    catch (Throwable t)
     
    653668            <%
    654669          }
     670          time += System.currentTimeMillis();
    655671          %>
    656672          </tbl:rows>
    657673        </tbl:data>
    658674        </tbl:table>
     675        <%=time %> ms
    659676        </base:section>
    660677        <%
Note: See TracChangeset for help on using the changeset viewer.