login about faq

I am having some trouble with multithreading and throughput.

private static Chilkat.HtmlToXml[] h2xml = new Chilkat.HtmlToXml[64];

later in my code . . .

    DoWorkEventHandler getSellerIPD = (sender, e) =>
    {
    h2xml[threadIdx] = new Chilkat.HtmlToXml();
    Chilkat.HtmlToXml h2xfile = new Chilkat.HtmlToXml();

. . .

    strHTMLary[threadIdx] = h2xfile.ReadFileToString(fn, "utf-8");
    h2xml[threadIdx].Html = strHTMLary[threadIdx];
    strXMLary[threadIdx] = h2xml[threadIdx].ToXml();
    }

The above is just a portion of the code I am dealing with, but after much testing, everything performs as expected except the .ToXml(). It performs very slowly compared to its single threaded equivalent. The elapsed time for a single thread (i.e., threadIdx=0) is roughly the same as when having 4 threads. In other words, if I comment out the line with the .ToXml(), multithreading gives me the throughput I am looking for.

Is .ToXml() thread safe? Is the above legal/supported? Any thoughts on this is appreciated.

asked Jul 02 '12 at 23:36

nomadicus's gravatar image

nomadicus
46335


After reviewing the internal Chilkat source, I think I see the problem and it has to do with the multi-thread safety. These new builds should fix it:

2.0/3.5 Framework:

32-bit: http://www.chilkatsoft.com/preRelease/ChilkatDotNet2.zip
64-bit: http://www.chilkatsoft.com/preRelease/ChilkatDotNet2_x64.zip

4.0 Framework:

32-bit: http://www.chilkatsoft.com/preRelease/ChilkatDotNet4.zip
64-bit: http://www.chilkatsoft.com/preRelease/ChilkatDotNet4_x64.zip

link

answered Jul 03 '12 at 16:07

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×59
×20

Asked: Jul 02 '12 at 23:36

Seen: 2,703 times

Last updated: Jul 06 '12 at 09:20

powered by OSQA