-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lazily create nested enums #11
Comments
|
Have you had any time to look into this? Profiling shows that most of the time is (kind of obviously) spent in retain and release calls. So it would be hugely beneficial to circumvent Swifts memory management here. Of course, most people will never see these problems when working with small XML files and I could use the raw NSXMLParser. But hey, SWXMLHash is really pretty ;) (and 'Swifty') |
Now that is a perfect use case for lazy parsing! 😃 I haven't had a chance to yet, but it is definitely on my to do list. Would it be possible to share the XML file (or perhaps a sanitized version of it) so that I can easily compare/contrast the differences in performance, etc.? If it is too big of a hassle then no worries. |
Sadly I am not allowed to give out the data :( |
See this gist for my current thoughts on how I think I might approach lazy loading. Anything I'm missing with that general approach? I'm conceptually thinking of each subscript operation as a stream or path of operations and, given that, I should be able to parse only the XML elements in that stream. |
I've begun work on this and have created #17 to track this work. |
I think this is ready for a first iteration now - apologies on taking so long getting something going here! @tkrajacic do you think you could pull down PR #17 and see how it handles your 35MB file? Before I bring this in to master, I'd like to make sure I'm actually improving the performance :) A few notes... I initially tried to detect when it was safe to stop parsing, but I don't think that will work with all XML fragments, so the |
Ok, I am speechless :) Those are just quick comparisons. And now for the kicker: I still can't stop grinning :D |
That's awesome! Glad it works! Quick question - are you targeting Xcode 6.3 or an earlier version? I only ask because if you're targeting an earlier version, I will just merge this into master. There are very few changes in my PR that assume Swift 1.2, so it would be easy to drop them. |
I am only using Xcode 6.3 anymore. |
Okay - I'll just merge into the xcode-6.3 branch then. |
It's now live in the xcode-6.3 branch - I'll go ahead and close this issue. Thanks so much for your help with both the suggestion and with testing this! |
update for Xcode 7 Beta 6
Reading https://devforums.apple.com/message/1101244#1101244 it makes me think that this would be the right way to create the nested enum structure lazily.
Any thoughts?
The text was updated successfully, but these errors were encountered: