l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2008 Mar 03 10:34

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
RE: [vox-tech] can you run it faster for my 110 program?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [vox-tech] can you run it faster for my 110 program?

  • Subject: RE: [vox-tech] can you run it faster for my 110 program?
  • From: "Chan Xan Huang" <bevis@ucdavMAPSis.edu>
  • Date: Fri, 08 Jun 2001 00:57:41 -0700
  • References: Pine.GSO.4.31.0106080041280.16692-100000@ux10.cso.uiuc.edu

it is due now and thanx you guys , basically you guys suggest me not use
heap, so i change it
to a 2-dimension array which use stack, but the running time is just faster
very very little. it is due
now .  thanx for help anyway,

-----Original Message-----
From: owner-vox-tech@franz.mother.com
[mailto:owner-vox-tech@franz.mother.com]On Behalf Of -/\/\/\- (Mister
Sent: Thursday, June 07, 2001 10:56 PM
To: vox-tech@franz.mother.com
Subject: Re: [vox-tech] can you run it faster for my 110 program?

Your performance penalty is probably coming from the fact that you're
allocating data on the heap within a loop that you want to execute fast.
You should also avoid the stream I/O in the loop. That's another
performance penalty.  What is the source of the data?

Try a different strategy.  I.e, read all the input into some sort of
buffer, then efficiently compute in one fell-swoop your memory
requirements and allocate it all at once.  Then, construct your data
structures within the allocated memory region, and avoid the use of the
'new' operator if you can help it... This should speed things up a little.

I don't know the context in which this code is executing, otherwise I
could help you further.  Feel free to e-mail.  When's the deadline?
Looking at "weights and vertexes", I am thinking you're trying to tackle
some graph algorithm problem of sorts.

What's the target platform?  We can optimize this right down to the lowest
level, after, of course, we optimize your algorithms too.

First things first - save your current work, so you have a fall back if
your optimization efforts fail.

Pavan xxxxxx (xxxxxx@uiuc.edu)   http://www.students.uiuc.edu/~xxxxxx
Computer Engineering Student     University of Illinois @ Urbana-Champaign

Intel VP David House, In _EE_Times_, 16 October 1989: "Bill Gates says
no matter how much more power we can supply, he'll develop some really
exciting software that will bring the machine to its knees."

On Thu, 7 Jun 2001, Chan Yan Huang wrote:

> this part running painfully slow.  its correct but if i handin this i will
> lose all the pts in cpu speed contest
> that's about 30 % of program of my grade.  open for suggestion it is
> basically initialize a double pointer to
> take input.  but it is tooo ooo  slow , my instructor sean give zero for
> that.  and i can't think any improvement
> .  help man !!!!!!
> istream & operator>> (istream &in, Grid &grid)
> {
>  int x,edgesNum;
>  int i = 0 ;
>  while (in >> x)
>  {
>     in >> edgesNum; //the number of edges 1-5
>     grid.Vertices[x]->EdgeSize = edgesNum;
>     (grid.Vertices[x])->edges = new Edge *[edgesNum];   //2 nd edges is
>     while ( i<edgesNum)
>     {
>       grid.Vertices[x]->edges[i] = new Edge();
>       in >> grid.Vertices[x]->edges[i]->ToVertax;
>       in >> grid.Vertices[x]->edges[i]->Weight;
>       grid.Vertices[x]->edges[i]->FromVertax = x;
>       i++;
>     }
>     i = 0;
>  //might need a getline to go to next line for input
>  }
>   return in;
> } // operator>>

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.