Objective-C Implementation Pointers
- by Dwaine Bailey
Hi,
I am currently writing an XML parser that parses a lot of data, with a lot of different nodes (the XML isn't designed by me, and I have no control over the content...)
Anyway, it currently takes an unacceptably long time to download and read in (about 13 seconds) and so I'm looking for ways to increase the efficiency of the read.
I've written a function to create hash values, so that the program no longer has to do a lot of string comparison (just NSUInteger comparison), but this still isn't reducing the complexity of the read in...
So I thought maybe I could create an array of IMPs so that, I could then go something like:
for(int i = 0; i < [hashValues count]; i ++)
{
if(currHash == [[hashValues objectAtIndex:i] unsignedIntValue])
{
[impArray objectAtIndex:i];
}
}
Or something like that.
The only problem is that I don't know how to actually make the call to the IMP function?
I've read that I perform the selector that an IMP defines by going
IMP tImp = [impArray objectAtIndex:i];
tImp(self, @selector(methodName));
But, if I need to know the name of the selector anyway, what's the point?
Can anybody help me out with what I want to do? Or even just some more ways to increase the efficiency of the parser...