Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366803

Summary: Improve performance of CDOTransactionImpl.getID(InternalCDOObject, boolean)
Product: [Modeling] EMF Reporter: Victor Roldan Betancort <vroldanbet>
Component: cdo.coreAssignee: Victor Roldan Betancort <vroldanbet>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3 CC: andy.rytina
Version: 4.1Flags: stepper: review+
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: Lighter, Faster and Better
Attachments:
Description Flags
patch v1
none
patch v2
none
patch v3 none

Description Victor Roldan Betancort CLA 2011-12-15 08:24:47 EST
Recent profiling sessions in one of our applications reveal a big performance bottleneck in org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getID(InternalCDOObject, boolean), and more specifically in the following code snippet:

if (getDetachedObjects().containsValue(object))
{
  CDORevisionKey revKey = cleanRevisions.get(object);
  if (revKey != null)
  {
    id = revKey.getID();
  }
}

This bottleneck appears with big commits with lots of changes, where getDetachedObjects() returns a big collection.

Any enhacement should be backported to 4.0 too, as long as its technically possible.
Comment 1 Victor Roldan Betancort CLA 2011-12-15 08:55:08 EST
Changing the snippet to:

CDORevisionKey revKey = cleanRevisions.get(object);
if (revKey != null && getDetachedObjects().containsValue(object))
{
  id = revKey.getID();
}

dramatically improves performance (our tests indicates 67% improvement: execution time went down from 874 seconds to 286 seconds).

All test-cases pass.
Comment 2 Victor Roldan Betancort CLA 2011-12-15 08:59:34 EST
Created attachment 208434 [details]
patch v1

Proposed change
Comment 3 Eike Stepper CLA 2011-12-15 11:14:06 EST
I can't apply ;-(

Stepper@SOLIDSTATE ~/cdo (master)
$ git apply c:/develop/patches/bug_366803_v1.patch
fatal: corrupt patch at line 21
Comment 4 Victor Roldan Betancort CLA 2011-12-15 11:16:23 EST
Created attachment 208448 [details]
patch v2

Eike please try with this one.
Comment 5 Eike Stepper CLA 2011-12-15 11:47:51 EST
Comment on attachment 208448 [details]
patch v2

Still wrong patch format.
Comment 6 Victor Roldan Betancort CLA 2011-12-15 11:48:42 EST
Created attachment 208450 [details]
patch v3

ok, now command line!
Comment 7 Eike Stepper CLA 2011-12-15 12:26:27 EST
Port to 4.0 via bug 366840.
Comment 8 Victor Roldan Betancort CLA 2011-12-15 12:56:04 EST
Pushed to Master, commit b4d439314c266fc1c2c137d563f136728067fd8d
Comment 9 Victor Roldan Betancort CLA 2011-12-15 12:56:26 EST
Pushed to Master, commit b4d439314c266fc1c2c137d563f136728067fd8d
Comment 10 Eike Stepper CLA 2013-06-27 03:28:01 EDT
Available in R20130213-0014 (4.1.2)