Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366803 - Improve performance of CDOTransactionImpl.getID(InternalCDOObject, boolean)
Summary: Improve performance of CDOTransactionImpl.getID(InternalCDOObject, boolean)
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Victor Roldan Betancort CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard: Lighter, Faster and Better
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-15 08:24 EST by Victor Roldan Betancort CLA
Modified: 2013-06-27 03:28 EDT (History)
1 user (show)

See Also:
stepper: review+


Attachments
patch v1 (1.04 KB, patch)
2011-12-15 08:59 EST, Victor Roldan Betancort CLA
no flags Details | Diff
patch v2 (1.32 KB, patch)
2011-12-15 11:16 EST, Victor Roldan Betancort CLA
no flags Details | Diff
patch v3 (1.53 KB, patch)
2011-12-15 11:48 EST, Victor Roldan Betancort CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)