[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance of NS



On Thu, 10 Feb 2000, Wei Tsang Ooi wrote:

> Is anyone working on improving the performance of ns ?

well, not the people writing stuff like:

for(unsigned int i = 0; i < sizeof(value) / sizeof(unsigned long);
++i) {
(codeword.cc)

or

for (int i = 0 ; i < (tcp_now - T_last)/rto; i ++) {
(tcp.cc)                                      ^?

There are quite a few places where stuff being computed every time
round a for loop (class stuff, yet) could be precomputed and assigned
to a temporary variable - but this observation is trivial compared
to enormity of the OTcl routing overhead.

L.

wants working fast multipath and cost routing in C++, and hasn't the
foggiest how to code it.


> IMHO, a lot of design decisions in ns are made to allow
> rapid-prototyping but not high performance.  As a result,
> ns crawls when the simulated network is large.
> 
> Below are some ideas I am exploring, but I am not familiar
> with ns enough to make any changes and still be sure that
> no others will be affected.
> 
> - profiles the otcl code in ns, and identify bottlenecks.
>   it should not be too difficult to insert code into otcl
>   to see how many times each Otcl instproc is called, and
>   how long each call takes.  
> 
> - optimizes the bottleneck somehow.  For example, I believe
>   "set" and "instvar" are the most common calls.  Is there a
>   way to speed these up (like by-passing the lookup) ?
> 
> - can some of the otcl code be moved into C++  space ?
>   For example, Node::add-route is called O(n^2) time
>   in Simulator::compute-flat-route, and is a major bottleneck
>   in start-up time.
> 
> - plain and simple code optimization.  For example, the current
>   Timer class (tcl/mcast/timer.tcl) makes many redundant calls
>   to "$ns cancel $id".  Also, we should be able to make 
>   RouteLogic::compute_routes() run faster.
> 
> Any comments ?
> -- 
> ______________________________________________________________
> weitsang@cs.cornell.edu  System Lab, Upson Hall (607) 255-0102
> 

<L.Wood@surrey.ac.uk>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>