Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper))
Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper))
- Subject: Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper))
- From: OC <email@hidden>
- Date: Thu, 22 Jan 2015 19:32:38 +0100
Samuel,
thanks for the advices!
On 22. 1. 2015, at 17:35, Samuel Pelletier <email@hidden> wrote:
>> Precisely what I did. Works well, but is unacceptably slow (even if I cache unarchived dictionaries in Eos, fetching and unarchiving just the first time).
>
> If your dictionaries are stables and mostly read-only, you may cache then globally using your EO globalID as the key and add some way te refresh them (time, notification of change, ...) That would be way faster and less memory hungry.
As for this, well, I must be missing something fairly obvious, but... how on earth could be just anything (globalID-based or not) faster than my cache-in-EO code, which (somewhat simplified for better readability) looks essentially like this:
class OCSEnterpriseObject extends ERXGenericRecord {
private NSMutableDictionary archivedObjectsCache=nil
def unarchivedObjectForKey(String archivedkey) {
def obj=this.@archivedObjectsCache[archivedkey]
if (obj==NSKeyValueCoding.Null) return nil
if (obj==nil) {
NSData d=storedValueForKey(archivedkey)
if (d!=nil) obj=Archivation.objectFromArchivedData(d)
if (this.@archivedObjectsCache==nil) this.@archivedObjectsCache=NSMutableDictionary.dictionary
this.@archivedObjectsCache[archivedkey]=obj!=nil?obj:NSKeyValueCoding.Null
}
obj
}
void setUnarchivedObjectForKey(obj,String archivedkey) {
if (this.@archivedObjectsCache==nil) this.@archivedObjectsCache=NSMutableDictionary.dictionary
this.@archivedObjectsCache[archivedkey]=obj!=nil?obj:NSKeyValueCoding.Null
if (obj!=nil) obj=Archivation.archivedDataFromObject(obj)
takeStoredValueForKey(obj,archivedkey)
}
}
? I can see memory possibly saved with some sharing if more different EOs happen to have same attributes (but it would complicate the code by forcing some kind of copy-on-write-if-differs behaviour, and I rather suspect it would not be worth the effort), but I simply can't see any possible speedup.
What am I overlooking?
Thanks and all the best,
OC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden