Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Ide MT
Ide MT [message #31227] Wed, 16 February 2011 10:42 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
(A reply to PM)

raxvan wrote on Wed, 16 February 2011 04:27

Hello,

I would like to know if do you want to keep the ide single threaded?




So far yes.

Quote:


Because the design of Include Assist was made to work with a thread, and i have to do some major refactoring to adjust to this. Also i was planning to add some more nice features and all of the would work nice if i could use the CoWork. Features like The minimap from Sublime text, and more features to the assist.



Actually, I will have to check the patch yet to see it... But generally, the idea that you are REQUIRING CoWork and MT is frightening me a bit, because CoWork by definition does the same thing in ST just as in MT (performs a loop), the only difference is that in MT it runs parallel.

Quote:


Anyway , i just don't like keeping everything on a single thread, and if more stuff is going to be added the ide will start to work slow Sad.



Well, that is debatable. In the moment I will see we need MT, I am for going that path.

So far, there was no such real requirement and theide is generally fast. #include Assist is definitely not the case that would require this.

BTW, strictly speaking, MT flag slows down single-threaded code. In current U++ incarnation, it is in low percents, but still...

Mirek
Re: Ide MT [message #31229 is a reply to message #31227] Wed, 16 February 2011 11:06 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
mirek wrote on Wed, 16 February 2011 10:42


Actually, I will have to check the patch yet to see it... But generally, the idea that you are REQUIRING CoWork and MT is frightening me a bit.


I shouldn't Smile. I find it natural for time consuming tasks to run them on a separate thread.
Quote:


Well, that is debatable. In the moment I will see we need MT, I am for going that path.


Having a MT flag, even if not on tha primary configuration, would be nice Smile.
Quote:


So far, there was no such real requirement and theide is generally fast. #include Assist is definitely not the case that would require this.


Fast, except the ubuntu version. Is i have more then ~50 files opened it will run really slow even if i do just typing or scrolling the source file.


Raxvan.




92b48bf94855483bb4cec8bcc8c0c933
Re: Ide MT [message #31230 is a reply to message #31229] Wed, 16 February 2011 11:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
raxvan wrote on Wed, 16 February 2011 05:06

mirek wrote on Wed, 16 February 2011 10:42


Actually, I will have to check the patch yet to see it... But generally, the idea that you are REQUIRING CoWork and MT is frightening me a bit.


I shouldn't Smile. I find it natural for time consuming tasks to run them on a separate thread.



Problem is, with MT and CoWork, there is absolutely no guarantee that it will run in separate thread...

If you really feel like you absolutely need to run something in separate thread, then create Thread and start it Smile

But there are many catches with MT and GUI. E.g. something as trivial as hitting close button of TheIDE would cause you a lot of pain...

Quote:


Fast, except the ubuntu version. Is i have more then ~50 files opened it will run really slow even if i do just typing or scrolling the source file.



Well, that is just weird. I do not see a reason why this should be slow.

But then again, I still have to check your code...

Mirek
Re: Ide MT [message #31232 is a reply to message #31227] Wed, 16 February 2011 11:18 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Mirek,

I have one remark to this topic, although not really related to MT. The initialization of Assist++ and Topic++ at the start of theide can be quite lengthy, especially for big projects on slow computer (like mine Smile ). As none of these is directly necessary for programmer to work, they could be simply performed in background. Only if the programmer decides to bring up Assist before the scan is complete, he might have to wait, but otherwise he can start working couple seconds earlier. No wasting time, time is money Very Happy Also applications that start quickly IMHO look much more "cool", in comparison to bloated, slow to start software (Don't you hate it when you have to look 30s at splash screen before you can start to do some simple editing job in OpenOffice? Smile ).

This is of course possible to implement in ST as well. Possibly the best solution would be to provide some generic way to allow such tasks to run using callbacks and ProcessEvents() in ST and Threads in MT, so that in both cases maximum efficiency would be achieved.

Best regards,
Honza
Re: Ide MT [message #31233 is a reply to message #31232] Wed, 16 February 2011 11:50 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

You're right Honza about ide startup. Although theide startup time is very fast comparing to other popular ides watching assist and topic parsing progress is annoying. IMO going MT is the right step, even if it costs a little bit (besides cpus are getting more and more cores).
Re: Ide MT [message #31234 is a reply to message #31232] Wed, 16 February 2011 11:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hm, actually, I might not have noticed before (well, at 3.2Ghz it is not quite noticeable), but it looks to me that at the start there is quite a long "Indexing topic" phase.

I guess before opening Pandora's box, we should simply try to optimize that out. In fact, if I remember well, I was considering this some time ago, I believe that the issue there is simply that caching mechanism of topic indexing is suboptimal... but then again, it was minor issue to wait 3 seconds at the start of theide so far...

[Updated on: Wed, 16 February 2011 11:53]

Report message to a moderator

Re: Ide MT [message #31236 is a reply to message #31234] Wed, 16 February 2011 12:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello all

I also agree with Honza. It would be good to open TheIDE immediately and perhaps to see a progress bar at the bottom of the screen indicating the indexing.


Best regards
IƱaki
Re: Ide MT [message #31237 is a reply to message #31230] Wed, 16 February 2011 12:30 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
mirek wrote on Wed, 16 February 2011 11:11


Problem is, with MT and CoWork, there is absolutely no guarantee that it will run in separate thread...

If you really feel like you absolutely need to run something in separate thread, then create Thread and start it Smile



Ow , i had no idea about that. Perhaps CoWork should always run tasks in a separate thread. Initially i was going to use a Thread but i found out that CoWork was much easier to use.

mirek wrote on Wed, 16 February 2011 11:11


But there are many catches with MT and GUI. E.g. something as trivial as hitting close button of TheIDE would cause you a lot of pain...



I think the best solution would be the one Honza proposed:
"provide some generic way to allow such tasks to run using callbacks and ProcessEvents() in ST and Threads in MT, so that in both cases maximum efficiency would be achieved."

In any case, The support for MT should be a added because CPU-s will probably not get a lot faster, and adding more features will not make thing easier.

Raxvan.


92b48bf94855483bb4cec8bcc8c0c933
Re: Ide MT [message #31238 is a reply to message #31236] Wed, 16 February 2011 12:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 16 February 2011 06:11

Hello all

I also agree with Honza. It would be good to open TheIDE immediately and perhaps to see a progress bar at the bottom of the screen indicating the indexing.


It would. It could also mean that for the next year, theide will be unstable...

Re: Ide MT [message #31239 is a reply to message #31237] Wed, 16 February 2011 12:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
raxvan wrote on Wed, 16 February 2011 06:30

mirek wrote on Wed, 16 February 2011 11:11


Problem is, with MT and CoWork, there is absolutely no guarantee that it will run in separate thread...

If you really feel like you absolutely need to run something in separate thread, then create Thread and start it Smile



Ow , i had no idea about that. Perhaps CoWork should always run tasks in a separate thread. Initially i was going to use a Thread but i found out that CoWork was much easier to use.



The idea there is CoWork is 'optimized optimization' to fully exploit all cores.

E.g. it only starts limited number of worker threads per application and those never finish (until app exit). Then assigns pieces of work to them as needed.

If you would use CoWork just to run a thread in parallel on more places in the app, it can easilly happen that there will be no threads available.

Mirek
Re: Ide MT [message #31241 is a reply to message #31238] Wed, 16 February 2011 13:56 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mirek wrote on Wed, 16 February 2011 12:46

koldo wrote on Wed, 16 February 2011 06:11

Hello all

I also agree with Honza. It would be good to open TheIDE immediately and perhaps to see a progress bar at the bottom of the screen indicating the indexing.


It would. It could also mean that for the next year, theide will be unstable...

I definitely don't want that Smile But I hope there is enough developers willing to test any new code before it is merged in the trunk, so that it is thoroughly tested and we are sure it is stable.

I posted first draft of a class that could help with this in separate thread (it doesn't belong here, as it might be used in any application, not only theide).

Honza

[Updated on: Wed, 16 February 2011 13:58]

Report message to a moderator

Re: Ide MT [message #31243 is a reply to message #31239] Wed, 16 February 2011 14:08 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
mirek wrote on Wed, 16 February 2011 12:50

raxvan wrote on Wed, 16 February 2011 06:30

mirek wrote on Wed, 16 February 2011 11:11


Problem is, with MT and CoWork, there is absolutely no guarantee that it will run in separate thread...

If you really feel like you absolutely need to run something in separate thread, then create Thread and start it Smile



Ow , i had no idea about that. Perhaps CoWork should always run tasks in a separate thread. Initially i was going to use a Thread but i found out that CoWork was much easier to use.



The idea there is CoWork is 'optimized optimization' to fully exploit all cores.

E.g. it only starts limited number of worker threads per application and those never finish (until app exit). Then assigns pieces of work to them as needed.

If you would use CoWork just to run a thread in parallel on more places in the app, it can easilly happen that there will be no threads available.

Mirek

A thread pool fits perfectly for a variety of use cases. I don't think there will be a problem using a CoWork in a lot of places, as long as the size limitation of the queue is removed. I can see from the implementation the limit is caped to 128 and after that the job will run on the requesting thread.

I used CoWork in the idea that in the future this will be used in some other places two, avoiding thread spamming.

Raxvan.



92b48bf94855483bb4cec8bcc8c0c933
Re: Ide MT [message #31246 is a reply to message #31243] Wed, 16 February 2011 15:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
raxvan wrote on Wed, 16 February 2011 08:08


A thread pool fits perfectly for a variety of use cases. I don't think there will be a problem using a CoWork in a lot of places, as long as the size limitation of the queue is removed. I can see from the implementation the limit is caped to 128 and after that the job will run on the requesting thread.



I believe the limitation is a smart move - 128 work chunks is enough to keep worker threads busy, so main thread can do a work chunk instead of waiting for any worker thread to be available.
Re: Ide MT [message #31247 is a reply to message #31241] Wed, 16 February 2011 15:49 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
dolik.rce wrote on Wed, 16 February 2011 07:56


I definitely don't want that Smile But I hope there is enough developers willing to test any new code before it is merged in the trunk, so that it is thoroughly tested and we are sure it is stable.



I simply believe it is not worth investing resources there. I would optimize ST first.

Frankly, I am afraid that main problem with MT is that it "does not look that hard". Usually this opinion sustains until the first deadlock or race condition Smile

I would suggest to analyze "what is slow" in theide first before making hasty and disastrous decisions...

Mirek
Re: Ide MT [message #31249 is a reply to message #31247] Wed, 16 February 2011 16:19 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mirek wrote on Wed, 16 February 2011 15:49

dolik.rce wrote on Wed, 16 February 2011 07:56


I definitely don't want that Smile But I hope there is enough developers willing to test any new code before it is merged in the trunk, so that it is thoroughly tested and we are sure it is stable.



I simply believe it is not worth investing resources there. I would optimize ST first.

Frankly, I am afraid that main problem with MT is that it "does not look that hard". Usually this opinion sustains until the first deadlock or race condition Smile

I would suggest to analyze "what is slow" in theide first before making hasty and disastrous decisions...

Mirek


Sure, all I said was that the slow parts could be done in background. I even stated that it can be easily done in ST. If you can optimize the processing, well that's a bonus Smile But I think it is not strictly required - especially if the progress window wouldn't block me from using theide.

Honza
Re: Ide MT [message #31313 is a reply to message #31247] Sun, 20 February 2011 20:19 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
mirek wrote on Wed, 16 February 2011 15:49


......
Frankly, I am afraid that main problem with MT is that it "does not look that hard". Usually this opinion sustains until the first deadlock or race condition Smile



I fully agree, and tested by myself in my app Smile
It's enough to test/set a variable in the wrong place to have really hard to find bugs there.
It took to me quite long to have my MT app stable because of such subtle bugs... I guess that for theide would be a nightmare for long time.

Ciao

Max
Previous Topic: BackgroundTask
Next Topic: Linux anti-aliasing fonts problem
Goto Forum:
  


Current Time: Fri Mar 29 05:57:11 CET 2024

Total time taken to generate the page: 0.01767 seconds