htmlagilitypack multithreading

Регистрация
16.05.2014
Сообщения
141
Благодарностей
22
Баллы
18
Hello, first of all i dont have much knowledge about how multithreading, C# and importing libraries works - thats why i am asking the question.

My projects work without browser, i am importing HtmlAgilityPack.dll, System.XML in gac references and in directivies:



Then inside a project i am executing C# code like that:

C#:
HtmlDocument doc = new HtmlDocument();
    var asd = project.Variables["BROWSER_response"].Value;
    doc.LoadHtml(asd);

    // get all comment nodes using XPATH
    foreach (HtmlNode comment in doc.DocumentNode.SelectNodes("//comment()"))
    {
        comment.ParentNode.RemoveChild(comment);
    }
    return doc.DocumentNode.OuterHtml;
Running this at 150 threads is eating all of my cpu (but it still works fine - no lags or other issues on the machine - is it false usage?).
(even at 30-50 threads cpu is jumping up to 99%)






Wheres the problem?

http://htmlagilitypack.codeplex.com/ < for dll library (i am using the one in Net45 folder)
 

Вложения

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Parsing love CPU. That's all i wanna say.
You can decrease resourse usage by ZennoPoster itselt by increasing time of execution of each thread. Maybe instead 1 action use several ones in loop.
But you will be able to parse data without sufficient CPU usage
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)