Hi,
running the code below is about 100 times slower than running the same code without creating the thread.
#include
#include "TGraph.h"
void* test(void *arg)
{
return 0;
}
int main()
{
int i,j;
TGraph *g = new TGraph(1000);
TThread *thread = new TThread(“test”, test);
for (i=0;i<1000;i++) {
for (j=0;j<1000>SetPoint(j,j,j);
}
}
return 0;
}
Matthias
brun
November 23, 2006, 10:33am
2
Your code cannot be compiled. Could you post it and disable html
or add it as an attachment?
Could you indicate which version of ROOT, OS, compiler, etc.
I cannot reproduce the problem with this piece of code
[code]#include <TThread.h>
#include "TGraph.h"
void* test(void *arg)
{
return 0;
}
int main()
{
int i,j;
TGraph *g = new TGraph(1000);
TThread *thread = new TThread(“test”, test);
for (i=0;i<1000;i++) {
for (j=0;j<1000;j++) {
g->SetPoint(j,j,j);
}
}
return 0;
}
[/code]
I’m using root 5.12/00 and VC++ 7.1
The problem is the gPad in the line
if (gPad) gPad->Modified();
in TGraph::SetPoint.
if I comment this line out it’s fast.
So I have to either comment out
TThread *thread = new TThread(“test”, test);
in my code, or
if (gPad) gPad->Modified();
in TGraph.
Matthias
#include <TThread.h>
#include "TGraph.h"
void* test(void *arg)
{
return 0;
}
int main()
{
int i,j;
TGraph *g = new TGraph(1000);
TThread *thread = new TThread(“test”, test);
for (i=0;i<1000;i++) {
for (j=0;j<1000;j++) {
g->SetPoint(j,j,j);
}
}
return 0;
}
brun
November 23, 2006, 11:42am
4
Your code is incomplete.
Please follow my instructions to post your code.
Rene