IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1825.68 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-07-11
Pages: < Prev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Next >
[01:32]<azyfm>Everyone has threading issues
[01:32]<jdvgdjgcgd>yeah
[01:32]<d0`>No when I have this: if (HDScheduler.hdWaitForCompletion(hGravityWell, HDScheduler.HD_WAIT_CHECK_STATUS) == '0')
[01:32]<lnvnzxu>what do you mean "removing assignment to use constructor"
[01:32]<d0`>it is surrounding by this while : while (schedulerStatus)
[01:32]<d0`>my whole apploication freezes....
[01:32]<jdvgdjgcgd>did I say that?
[01:32]<d0`>yea :)
[01:32]<d0`>How do I fix it?
[01:32]<d0`>I need that whoile...
[01:32]<lnvnzxu>well, i paraphrased
[01:33]<lnvnzxu>"remove the assignment so only constructor" i believe was the exact phrase
[01:33]<jdvgdjgcgd>well, this is essentially it: (4 line paste coming)
[01:33]<d0`>what does that mean?
[01:33]<azyfm>m0: if you do anything prolonged on an UI thread, the message pump for the app will block, and it'll appear to be hung
[01:33]<d0`>remove the assignment?
[01:33]<jdvgdjgcgd>Device[] list = new Device[ 1000000 ];
[01:33]<lnvnzxu>m0`: talking to Jivemonkey, sorry
[01:33]<jdvgdjgcgd>for( int i=0; i<list.Length; i++ ) {
[01:33]<jdvgdjgcgd> Device d = new Device();
[01:34]<jdvgdjgcgd> list[i] = d;
[01:34]<jdvgdjgcgd>}
[01:34]<d0`>Arild: So how do I debug his?
[01:34]<jdvgdjgcgd>If i comment out: list[i]=d; the iterations happen in a few ms
[01:34]<azyfm>well, if you're going to be doing any blocking operations, move them to another thread
[01:34]<jdvgdjgcgd>if I include it, it takes 12 seconds
[01:34]<azyfm>compiler or JIT optimization
[01:34]<d0`>Arild, nothing is wrong, hmm oh boy I hate threads:(
[01:34]<jdvgdjgcgd>yeah what the crap is it doing
[01:34]<lnvnzxu>Jivemonkey: likely the compiler can optimize out the Device allocation because the constructor and finalizer are proven to have no side-effects, and d is never used
[01:34]<d0`>I always gointo deadlocks
[01:35]<jdvgdjgcgd>oh
[01:35]<jdvgdjgcgd>that makes sense
[01:35]<jdvgdjgcgd>so why does it take 12 seconds
[01:35]<jdvgdjgcgd>thats way too long, thats what i'm trying to optimize
[01:35]<d0`>my application already takes 16 threads, and I never did threads
[01:36]<jdvgdjgcgd>i have a self contained compilable example
[01:36]<lnvnzxu>that's not too bad for a million allocations
[01:36]<azyfm>what are you doing with 16 threads?
[01:36]<jdvgdjgcgd>its 12 seconds even on 600k
[01:36]<jdvgdjgcgd>thats way too long, you can allocate ints in ms
[01:36]<jdvgdjgcgd>even object o = new object();
[01:37]<azyfm>you're saying that the time spent isn't proportional to the number of objects?
[01:37]<gjds>what is the mask value for an only-letter input ?
[01:37]<jdvgdjgcgd>it is, my 1million example is a little longer than 12 seconds
[01:37]<jdvgdjgcgd>i used 12 seconds as a general ballpark figure
[01:37]<gjds>number is # or 0
[01:37]<gjds>but if i use A, X or any letter i can input numbers too
[01:38]<jdvgdjgcgd>http://pastehere.com/?bitvbh
[01:38]<jdvgdjgcgd>here is the self contained compilable example
[01:38]<jdvgdjgcgd>i'm boxing in this example just as a test
[01:38]<jdvgdjgcgd>but its too slow even without it
[01:40]<gjds>oh, i found it ;D
[01:41]<azyfm>well, try a profiler, Jivers
[01:41]<azyfm>Jivemonkey
[01:43]<lnvnzxu>well, it looks like you'll have millions of reference type allocations from the Device constructor
[01:43]<lnvnzxu>a profiler is your best bet
[01:44]<lnvnzxu>at least 4 million (Device + 3 ArrayLists)
[01:45]<lnvnzxu>the string assignments should go pretty quickly; my guess is the majority of the time is spent in object allocation
[01:46]<ymuggjt0ot>holy crap a million allocations?
[01:46]<d0`>hey can someone please explain me about threads in the forms?
[01:46]<d0`>Why does my application have 16 threads
[01:46]<lnvnzxu>ok i need to hit the gym, bbl
[01:46]<d0`>I never created threads for it
[01:46]<d0`>cya peterhu
[01:47]<d0`>Arild - Is each form a thread?
[01:47]<azyfm>no
[01:47]<d0`>hmm
[01:47]<d0`>Tjhats why
[01:47]<d0`>I have to make a thread for that loop
[01:47]<azyfm>there's an UI thread, and a finalizer thread, and a GC thread
[01:47]<azyfm>dunno where the rest come from
[01:47]<d0`>they might be for the debug
[01:47]<azyfm>break in the debugger, go to the threads view and see where they're at?
[01:48]<d0`>I am runnign it as Debug mode, so I guess they are for it
[01:48]<azyfm>try that
[01:48]<ymuggjt0ot>threads are auto magic
[01:48]<d0`>I have the main Form, and I ahve an infinite loop inside it , thats whats causing it to freeze the rest of the program
[01:48]<d0`>so I need to place the inifinte loop in a thread I guess (different thread)
[01:48]<ymuggjt0ot>dont do that.. use sleep
[01:49]<azyfm>eh? sleep?
[01:49]<ymuggjt0ot>infinite loops are bad unless you block
[01:49]<d0`>why?/
[01:49]<azyfm>sleeping blocks the UI thread as well
[01:49]<d0`>does anyone know the __kbhit() function in c++?
[01:49]<d0`>does that run on its own thread?
[01:49]<azyfm>doubt it
[01:50]<ymuggjt0ot>wait wait, he was talking about the UI thread? that should always be free
[01:50]<azyfm>he is
[01:50]<jdvgdjgcgd>hmm
[01:50]<azyfm>and he has a call in the infinite loop that blocks, so sleep shouldn't be necessary
[01:50]<jdvgdjgcgd>i will have to redesign this component
[01:50]<ymuggjt0ot>dont do anything that takes a long time in your UI thread, use asynchronous calls or worker threads
[01:51]<jdvgdjgcgd>why the hell do you have an infinite loop anywayas
[01:51]<jdvgdjgcgd>if you block on the next call
[01:51]<jdvgdjgcgd>polling around a blocking call... useless
[01:51]<ymuggjt0ot>actually can you still access a UI if the UI thread is blocked?
[01:51]<jdvgdjgcgd>thats like wearing a diaper and a tampon at the same time
[01:51]<jdvgdjgcgd>no, the ui thread does the repainting







