Hi Willie,

The Clause#valueOf is used internally by the ObjectContracts#toString and
ObjectContracts#hashCodeOf, make heavy use of reflection.

There's a warning about ObjectContract not being used in prod [1] for this
reason, but - that said - your code doesn't reference either
ObjectContracts or Clause.

If you want to set a breakpoint in Clause#getValueOf(...), then you should
be able to see what the framework is attempting to do.

My guess is that the stack trace will show that the framework is trying to
determine a title for this view model, and somewhere in there is where the
call gets made.  If so, then the fix will be to implement a custom title()
method.

HTH

Dan

[1]
http://isis.apache.org/guides/rgcms.html#_rgcms_classes_utility_ObjectContracts

On Wed, 22 Feb 2017, 07:54 Willie Loyd Tandingan, <[email protected]>
wrote:

Hello!

We currently have a performance problem with RO in production environment
with one of our actions.

This action (SalesOrderRestMenu#filter) returns a list of view models
(SalesOrderView) and the client-side, an SPA, invokes this action accepting
simplified representation (Accept header set to
"application/json;profile=urn:org.apache.isis/v1;suppress=true"). When this
action returns around 601 items, it takes ~16 seconds on my development
machine to process. Profiling shows that Clause#getValueOf consumes 12
seconds of this CPU time needed to complete the request [1].

Any help on how to improve this is highly appreciated!

This is how the view model looks like:

@DomainObject(nature = Nature.INMEMORY_ENTITY)
public class SalesOrderView {

    //region > constructors
    public SalesOrderView() {
    }

    public SalesOrderView(final SalesOrder salesOrder) {
        setSalesOrder(salesOrder);
    }

    public SalesOrderView(
            final SalesOrder salesOrder,
            final String wholesaler,
            final String retailer,
            final String courier,
            final BigDecimal total) {
        setSalesOrder(salesOrder);
        setWholesaler(wholesaler);
        setRetailer(retailer);
        setCourier(courier);
        setTotal(total);
    }
    //endregion

    //region > salesOrder (property)
    @Property(hidden = Where.EVERYWHERE)
    @Getter @Setter
    private SalesOrder salesOrder;
    //endregion

    //region > wholesaler (property)
    @Getter @Setter
    private String wholesaler;
    //endregion

    //region > retailer (property)
    @Getter @Setter
    private String retailer;
    //endregion

    //region > courier (property)
    @Getter @Setter
    private String courier;
    //endregion

    //region > total (property)
    @Getter @Setter
    private BigDecimal total;
    //endregion

    //region > derived properties
    public String getId() {
        return getSalesOrder().getId();
    }

    public String getSalesOrderNumber() {
        return getSalesOrder().getSalesOrderNumber();
    }

    public LocalDate getOrderDate() {
        return getSalesOrder().getOrderDate();
    }

    public LocalDate getShipmentDate() {
        return getSalesOrder().getShipmentDate();
    }

    public LocalDate getDeliveryDate() {
        return getSalesOrder().getDeliveryDate();
    }

    public Status getStatus() {
        return getSalesOrder().getStatus();
    }

    public String getRemarks() {
        return getSalesOrder().getRemarks();
    }
    //endregion

}


Best regards,
Willie


[1] http://imgur.com/a/NlDel

Reply via email to