cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cosmin Marian (JIRA)" <>
Subject [jira] Created: (CAY-1468) Commit performance degradation
Date Fri, 23 Jul 2010 07:54:51 GMT
Commit performance degradation

                 Key: CAY-1468
             Project: Cayenne
          Issue Type: Bug
          Components: Core Library
    Affects Versions: 3.0
            Reporter: Cosmin Marian

While developing an application using Cayenne I noticed that the
performance of  DataContext.commitChanges()  degrades with the number of
commits done.

To be more specific, I have a model with two entities: Result and
ResultStream, with a many to one relation from Result to ResultStream.

The test I do is simple: I generate a lot of Result objects, all linked to
the same ResultStream and I call commit after each Result added to the
DataContext and measure the time it takes to perform the commit. I notice
that this time grows fairly linear. Of course, the growth is noticeably
after generating many results

Here is the source code of the test:

public class Main {

    public static void main(String[] args) {
        DataContext dc = DataContext.createDataContext();

        final int stepSize = 500;
        final int nbSteps = 50;

        SelectQuery sq = new SelectQuery(ResultStream.class);

        ResultStream rs = (ResultStream) dc.performQuery(sq).get(0);

        StopWatch sw = new StopWatch();

        for (int i = 1; i <= nbSteps * stepSize; ++i) {
            Result t = new Result();


            if (i % stepSize == 0) {
                System.out.printf("%6d, %s, %5d\n", i,

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message