-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Describe the bug
Hello! We are trying to optimize our code and is looking at enabling di_Configurations__c.UsePlatformCacheToStoreBindings__c
And we are noticing that the UnitOfWork newInstance is slower when cache is enabled. I might be wrong but it seems that if cache is enabled, it is adding the binding to the cache but not using the cached binding in the succeeding execution?
To Reproduce
I have in total:
- 8 domain bindings
- 26 selector bindings
- 19 service bindings
- 6 unit of working bindings
In a scratch org, running the code below yields these CPU time results:
fflib_ISObjectUnitOfWork uow = new fflib_SObjectUnitOfWork();
- Disabled cache CPU time: 222 out of 10000
- Enabled cache CPU time (3rd execution): 585 out of 10000
Selector test with 1 id, WHERE ID IN
condition
List<XObject> tickets = XObjectSelector.newInstance().selectByIds(new Set<String> { 'XObjectID' });
- Disabled cache CPU time: 254 out of 10000
- Enabled cache Maximum CPU time: 0 out of 10000 --
Expected behavior
Faster execution is our expected result which we found in both Selector and Domain. Unfortunately the UnitOfWork newInstance is slower when cache is enabled.
Screenshots and text of error observed
Unit of work, cache Disabled
Unit of work, cache Enabled (3rd Execution)
Version
yes, we have the latest