Revision: 55618
          http://sourceforge.net/p/brlcad/code/55618
Author:   r_weiss
Date:     2013-05-31 16:56:12 +0000 (Fri, 31 May 2013)
Log Message:
-----------
Improve the speed of libged 'gqa' by reducing semaphore locking in function 
'plane_worker'.

Modified Paths:
--------------
    brlcad/trunk/src/libged/gqa.c

Modified: brlcad/trunk/src/libged/gqa.c
===================================================================
--- brlcad/trunk/src/libged/gqa.c       2013-05-31 16:51:53 UTC (rev 55617)
+++ brlcad/trunk/src/libged/gqa.c       2013-05-31 16:56:12 UTC (rev 55618)
@@ -1318,6 +1318,7 @@
     int u, v;
     double v_coord;
     struct cstate *state = (struct cstate *)ptr;
+    unsigned long shot_cnt;
 
     if (aborted)
        return;
@@ -1342,6 +1343,7 @@
 
     v = get_next_row(state);
 
+    shot_cnt = 0;
     while (v) {
 
        v_coord = v * gridSpacing;
@@ -1373,16 +1375,7 @@
                if (aborted)
                    return;
 
-               /* FIXME: This shots increment and its twin in the else clause 
below
-                * are presenting a significant drag on gqa performance via
-                * heavy duty semaphore locking and unlocking.  Can a way
-                * be found to do this job without needing to trigger the
-                * semaphore locks?  Seems to be the major contributor to
-                * semaphore overhead.
-                */
-               bu_semaphore_acquire(GED_SEM_STATS);
-               state->shots[state->curr_view]++;
-               bu_semaphore_release(GED_SEM_STATS);
+               shot_cnt++;
            }
        } else {
            /* shoot only the rays we need to on this row.  Some of
@@ -1405,9 +1398,7 @@
                if (aborted)
                    return;
 
-               bu_semaphore_acquire(GED_SEM_STATS);
-               state->shots[state->curr_view]++;
-               bu_semaphore_release(GED_SEM_STATS);
+               shot_cnt++;
 
                if (debug)
                    if (u+1 < state->steps[state->u_axis]) {
@@ -1434,6 +1425,7 @@
      * we'll have returned to serial computation.
      */
     bu_semaphore_acquire(GED_SEM_STATS);
+    state->shots[state->curr_view] += shot_cnt;
     state->m_lenDensity[state->curr_view] += ap.A_LENDEN; /* add our 
length*density value */
     state->m_len[state->curr_view] += ap.A_LEN; /* add our volume value */
     bu_semaphore_release(GED_SEM_STATS);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to