Hello,
I am in the process of converting the data format for my application from one
that just uses the NSKeyedArchiver methods to archive my objects to a file on
disk to using the NSXML classes to generate a custom XML file (I need to do
this for compatibility purposes). My main data object is essentially a
(potentially very long) list (or rather tree) of items, each of which have two
or three dates associated with them (among other things).
Having completed the initial conversion process, it turns out that currently my
XML-writing methods (using NSXMLElement, NSXMLDocument etc) are much, much
slower than using NSKeyedArchiver. Using Sample, it turns out that a lot of the
time is spent converting the NSDates for each of the items in my list to string
objects. I have tried this using two different methods:
NSDate *someDate = ...
[xmlElement addAttribute:[NSXMLNode attributeWithName:"SomeDate"
stringValue:[someDate descriptionWithLocale:nil]]];
and
NSXMLNode *attribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind];
[attribute setName:@"SomeDate"];
[attribute setObjectValue:someDate]
[xmlElement addAttribute:attribute];
[attribute release];
But either way suffers the same performance hit. So, my question is, does
anyone know of a much faster and more efficient way of converting NSDates to
NSStrings? (A possible solution would be to change my data model to store these
dates as strings internally so that the conversion is already done when they
come to be written to file, but I was hoping for a more elegant solution.)
Many thanks and all the best,
Keith
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]