Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: Now can i make a lot of threads of a same method?

Started 1 month ago by anonimo9999
Hi! I'm cooding an aplicattion that using only my method takes long time to be processed because it has to work with long text files (around 8 MB each file). Tha't because i've decided to take advantatge of multithreading but i don't know how to do that. I thougth in splitting the text file in smaller texts and working with them using the same method in multithreading and parallel so I've ...
Site: CodeProject: Discussion Boards. Free source code and programming help  CodeProject: Discussion Boards. Free source code and programming help - site profile
Forum: Visual Basic / VB.NET  Visual Basic / VB.NET - forum profile
Total authors: 3 authors
Total thread posts: 6 posts
Thread activity: no new posts during last week
Domain info for: codeproject.com

Other posts in this thread:

Dave Kreskowiak replied 1 month ago
First, creating that many threads is pointless. Second, allocating a thread also allocates 1MB of memory to go with it. So, if you actually had one thread running per object and had to process, say, 500 objects at once, you just ate up 500MB of RAM. Lastly, the largest number of threads you can use and still gain a performance benefit is the number of cores in your processor. Also, a hard ...

anonimo9999 replied 1 month ago
Mmmm it can be interesting... tomorrow i'll try it because now is time to go to sleep Seriously, because that program is for me and not to sell it I haven't thinked about RAM Anyway, I say you what the program does. Well what the program does is to take the text that i want of all the text file. In each text file there are a lot of lines and in each line there're some data separated by ...

Luc Pattyn replied 1 month ago
Hi, multi-threading will increase overall performance as long as: 1) you have idle cores (e.g. your system is a quad core and there mainly is a single app, which isn't multi-threaded at all) 2) or your active cores are not fully loaded because a lot of time is spent waiting on something (disk I/O, network I/O, etc). You can check both by looking at the performance pane of Task Manager while ...

Luc Pattyn replied 1 month ago
OK, having read the details now, I would not change a thing on your app. Look at Task Manager's performance pane and estimate average CPU load, lets say it is about 100%/Q (if Q is large, look again at your single-threaded code; don't use any Q higher than 5). Now split the files into Q folders, and run Q copies of your app at the same time, each dealing with one folder. That is about the best ...

Luc Pattyn replied 1 month ago
Some suggestions that may improve performance, and are applicable to a single-threaded or multi-threaded app: 1. don't use regexes for this, they are powerful however they are slower than simple string logic; 2. don't use string.Split() if all you need is one part Hence, use an overload of string.IndexOf() to find the Nth comma; use another IndexOf() to find the next one, then use string....

 

Top contributing authors

Name
Posts
Luc Pattyn
3
user's latest post:
Now can i make a lot of threads...
Published (2009-11-09 19:23:00)
Some suggestions that may improve performance, and are applicable to a single-threaded or multi-threaded app: 1. don't use regexes for this, they are powerful however they are slower than simple string logic; 2. don't use string.Split() if all you need is one part Hence, use an overload of string.IndexOf() to find the Nth comma; use another IndexOf() to find the next one, then use string.SubString BTW: this would fail if fields also...
anonimo9999
2
user's latest post:
Now can i make a lot of threads...
Published (2009-11-09 18:29:00)
Mmmm it can be interesting... tomorrow i'll try it because now is time to go to sleep Seriously, because that program is for me and not to sell it I haven't thinked about RAM Anyway, I say you what the program does. Well what the program does is to take the text that i want of all the text file. In each text file there are a lot of lines and in each line there're some data separated by commas representing they're columns...
Dave Kreskowiak
1
user's latest post:
Now can i make a lot of threads...
Published (2009-11-09 18:05:00)
First, creating that many threads is pointless. Second, allocating a thread also allocates 1MB of memory to go with it. So, if you actually had one thread running per object and had to process, say, 500 objects at once, you just ate up 500MB of RAM. Lastly, the largest number of threads you can use and still gain a performance benefit is the number of cores in your processor. Also, a hard drive can only read one area of the disk at a time, so...

Related threads on "CodeProject: Discussion Boards. Free source code and programming help":

Related threads on other sites:

Thread profile page for "Now can i make a lot of threads of a same method?" on http://www.codeproject.com. This report page is a snippet summary view from a single thread "Now can i make a lot of threads of a same method?", located on the Message Board at http://www.codeproject.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity