l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
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?



hate to be a poopy, but i just wanted to comment that there's a delicate
balance between help and unfair help.

this was ok; but we have a lot of new users on vox who have joined in the
past 2 weeks.  i wanted to point out to them that if you want help with
homework, use common sense:

1. clearly identify the request for help as being school related
2. no collaborative effort on code
3. vague terms and concepts are ok.  concrete code is not.

this is for lugod's safety, as well as the poster's.

again, this was absolutely fine; it just seemed like a good opportunity
to state vox's position on homework help for the new users.

pete



begin: Chan Yan Huang <bevis@ucdavis.edu> quote
> 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
> Resistor)
> 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>>
> >
> 

-- 
"The following addresses had permanent fatal errors..."      p@dirac.org
                               -- Mailer Daemon              www.dirac.org/p


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
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.