[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Netbeans 6.3 profiler and Jace: Now only uses 10% - 15% cpu!



On Friday, October 26, 2012 1:17:06 PM UTC-5, BLuRry wrote:
> On Friday, October 26, 2012 11:06:51 AM UTC-5, D Finnigan wrote:
> 
> > BLuRry wrote:
> 
> > 
> 
> > >
> 
> > 
> 
> > > Removing all that synchronization overhead means that now Jace is using
> 
> > 
> 
> > > 10%
> 
> > 
> 
> > > cpu instead of 60%.  I have more testing to ensure that no concurrent
> 
> > 
> 
> > > exceptions occur -- but I've learned my lesson.  Concurrency and resource
> 
> > 
> 
> > > synchronization are EXPENSIVE!
> 
> > 
> 
> > 
> 
> > 
> 
> > That makes me wonder if the synchronization was implemented using busy
> 
> > 
> 
> > waiting until the lock could be acquired.
> 
> 
> 
> It is ultimately up to the JVM.  But no, there was some overhead due to my stuff also.  The way that I synchronize memory access is to pause the emulator until the access is completed.  I do this because memory events can sometimes trigger listeners (especially for Cxxx accesses) and so simple pauses aren't sufficient or practical.  Especially if said Cxxx access causes the emulator to remap active memory (MMU emulation).  Anyway, most memory traffic (99% of it) is from the CPU so it just didn't make sense to force synchronization all the time.
> 
> 
> 
> The synchronization is cool when used right.  For example, its used to update the screen when the JACE message is drawn on boot as well as the "twinkle" animation loop.  There are a couple of other small cases (such as if you press F5 to "brun" a binary file).  Anyway, synchronized access is important especially if I implement more extensive plugins that have to co-exist with the emulator and run in separate threads.
> 
> 
> 
> I will post the updated binary to Sourceforge and announce with all the relevant changes/fixes.  For now, everything is committed to sourceforge for those who want to play with it.
> 
> 
> 
> -B

Sorry -- that was confusing.  I committed the code changes but the download link is still not the latest stuff.  If you want to play with the source or build it, the SVN tree is up to date.  Sorry for being so obtuse about that. :-)

-B