-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
CPU is high #9
Comments
Thanks for the tip. |
Can you share your test projects ? |
hello, You can compare with other library base on libxml2, and write some test code running many times, like : https://github.com/cezheng/Fuzi/blob/master/README.md I think maybe the reason is libxml2 is faster because of performance enhancement in many years.... but I don't like the libraries base on libxml2, they are not good in html and css Selector.. my code is normal usage such as: // let doc = try SwiftSoup.parse(stringData) |
Try now 1.2.5 , String builder was very slow to concatenate string and swift string get characters count very but very slow. |
New version available 1.2.6 , 2x compared to 1.2.5 |
hello, thank your fix I have test 1.2.8 with my pod: pod 'SwiftSoup', :git => 'https://github.com/scinfu/SwiftSoup.git' my project code is below:
and result is : it cause 140ms but i test with Fuzi, the code is :
the result : it cause 10 ms so I think the performance is not enough. |
Thank you, I'm making improvements and test to improve performance. |
consider using |
@lightsprint09 thank you I will try this where possible. |
@scinfu String performance should be a lot better in Swift 4. In Vapor we basically just cast everything to an array of bytes when parsing stuff. The UFT8 strictness is a real killer for performance |
@0xTim did you tried Swift4? |
No I haven't used Swift 4 much yet unfortunately. I also notice you are using Regex a lot, which is quite slow. Take a look at this presentation, which talks about building a parser from scratch, which was about 1000x quicker that a regex parser when they guy who gave it tested it on XML. Might be worth looking into long term, though I appreciate it is a big change! |
@sankxuan with 1.4..2 there is a major performance change in selection css
// 3.5837669968605
// 0.898868978023529 |
@0xTim it can be a good idea to use in Regex and CharacterReader.swift. |
toString() method is not working. (Node -> String) Why? |
I'm also having really slow performance when compared to Kanna. I like how similar this is to jSoup as I have to re-write the same code in both but swift soup is unusably slow for my application :( |
I'm doing tests to switch from string to a low-level parsing method. |
Now String performance is better in Swift 4, the library has gained in performance. |
thank you html parser , it's a very smart tool like jsoup. but i found when i use it , the cpu is very high.
I compare it with other tool base on libxml2 (like Fuzi, kanna).i test in my project , fuzzy and kanna use 10%-15% cpu when parse one web site, but swiftsoup is 60% and more.
but I like this project because of liking jsoup too.
The text was updated successfully, but these errors were encountered: