• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >ERXSQLHelper (From: OC <email@hidden>)
 >Re: ERXSQLHelper (From: Theodore Petrosky <email@hidden>)
 >Re: ERXSQLHelper (From: OC <email@hidden>)
 >Re: ERXSQLHelper (From: OC <email@hidden>)
 >Re: ERXSQLHelper (From: Timothy Worman <email@hidden>)
 >Re: ERXSQLHelper (From: OC <email@hidden>)
 >Re: ERXSQLHelper (From: Chuck Hill <email@hidden>)
 >Migrations (was: ERXSQLHelper) (From: OC <email@hidden>)
 >Re: Migrations (was: ERXSQLHelper) (From: Paul Hoadley <email@hidden>)
 >Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: OC <email@hidden>)
 >Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: Paul Hoadley <email@hidden>)
 >Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: OC <email@hidden>)
 >Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: Ramsey Gurley <email@hidden>)
 >Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: Samuel Pelletier <email@hidden>)
 >Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: OC <email@hidden>)
 >Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper)) (From: Samuel Pelletier <email@hidden>)

  • Prev by Date: Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper))
  • Next by Date: ERXMigraton and er.migration.skipModelNames
  • Previous by thread: Re: Model/DB synchronization (was: Migrations (was: ERXSQLHelper))
  • Next by thread: Re: ERXSQLHelper
  • Index(es):
    • Date
    • Thread