Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Codecompletion delays fixed in rev 1826 (update: in rev 1840)

<< < (6/9) > >>

thomas:
Well, look at the screenshot. The CPU is completely idle 50% of the time (and runs one thread during the other half, when it could run two).

An even better solution might be to have exactly one dedicated I/O thread which does all reads asynchronously, but sequentially and feeds the results to the blocking NUM_CPU+1 worker threads.
Under Linux, this probably won't bring an awful lot, since the elevator mechanism should already make sure that the hard disk is not trashing when two threads try to read concurrently, but I wouldn't be so sure about that under Windows...

If someone can produce a cross-platform (posix + Windows) memory mapping class, then we might leave that work to the OS, too. It would probably be the most efficient way, anyway.

Michael:
Just a suggestion. Would be of some interest the use of Win32 pthreads library in Windows? It was used to develop e.g., ViTooKi (a cross-platform C++ multimedia library).

Michael
 

thomas:

--- Quote from: Michael on January 24, 2006, 10:26:35 pm ---Just a suggestion. Would be of some interest the use of Win32 pthreads library in Windows?
--- End quote ---
Win32 pthreads does not offer memory mapping, unluckily. The functionality which it offers is in wxWidgets too, so I don't think we can gain a lot from using it.

Urxae:

--- Quote from: thomas on January 24, 2006, 09:47:33 pm ---If someone can produce a cross-platform (posix + Windows) memory mapping class, then we might leave that work to the OS, too. It would probably be the most efficient way, anyway.

--- End quote ---

Dare I suggest... Boost has such a class, in <boost/spirit/iterator/file_iterator.hpp>. It provides an iterator interface to files on disk.
There are basically 3 implementations (the appropriate one is selected using the preprocessor): One for Win32, one for Posix, and one using only the C++ standard library. The first two implement memory mapping, the other one is provided as a fallback.
If you don't want to include all of Boost though (which is understandable) you'll either have to check exactly which files are needed (and/or edit it to reduce dependencies manually) or perhaps just use it as an example for your own implementation.

The Boost license is GPL compatible, IIRC.

Game_Ender:
The boost license is about a loose as it gets you just need to basically include the copyright from the author and that's about it.  Boost has a good thread library too.  If you are going to use an external thread library I would use boost, because then you can use lots of the other wonderful stuff boost has.

As for this I have one question, why are we using threads at all if doesn't run more than one at once?  I think you mean it only runs one <i>extra</i> thread, counting the main thread if you have one CPU?, or it only one thread total include the main one? The whole point of threads is to run more than the number of processors you have because the CPU is rarely full on, threads of execution spend quite a bit of time waiting.  Also I think the threading model needs a thorough rewrite or going over because it dead locks all the time on linux.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version