9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: geoff@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] slow performance
Date: Sun,  1 Apr 2007 15:26:21 -0400	[thread overview]
Message-ID: <d8ded8c26ad9f3da2cf0bdf0f378ef77@plan9.bell-labs.com> (raw)
In-Reply-To: <e510e47e0704011211y45ae69e5uf8acb6312483f440@mail.gmail.com>

Before running 8.out, increase $profsize to eliminate the `Prof error':

	profsize=40000

I profiled this program and, after using Bprint for output, found that
allocating one node at a time was using much of the CPU time;
allocating a few thousand nodes at a time helps.  I also had to fix
some bugs; compile it with

	8c -FTVw tds.c

to see them.  The next biggest cost was tail recursion to find the
correct tree node for insertion; converting the tail recursion to
explicit iteration reduced the run time noticeably.  Given the large
number of nodes and the trivial nature of the operations on them, even
small coding changes can produce measurable improvements.  Final times
are:

	; time 8.out >/dev/null
	3.84u 0.01s 3.90r 	 8.out
	; cat /dev/cputype
	PentiumII/Xeon 333



  reply	other threads:[~2007-04-01 19:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-31 16:41 pedro henrique antunes de oliveira
2007-03-31 16:48 ` Lorenzo Fernando Bivens de la Fuente
2007-03-31 16:48 ` Charles Forsyth
2007-03-31 16:57   ` pedro henrique antunes de oliveira
2007-03-31 16:55 ` W B Hacker
2007-03-31 17:12   ` Uriel
2007-03-31 19:27     ` W B Hacker
2007-03-31 23:20       ` erik quanstrom
2007-03-31 23:35         ` pedro henrique antunes de oliveira
2007-04-01  1:40           ` erik quanstrom
2007-03-31 17:15   ` Charles Forsyth
2007-03-31 18:50 ` Armando Camarero
2007-03-31 21:05   ` C H Forsyth
2007-03-31 23:25     ` pedro henrique antunes de oliveira
2007-04-01  1:32       ` erik quanstrom
2007-04-01  9:22       ` Charles Forsyth
2007-04-01  9:52         ` pedro henrique antunes de oliveira
2007-04-01  9:56           ` pedro henrique antunes de oliveira
2007-04-01 18:24 ` ron minnich
2007-04-01 19:11   ` pedro henrique antunes de oliveira
2007-04-01 19:26     ` geoff [this message]
2007-04-01 19:57       ` pedro henrique antunes de oliveira
2007-04-01 20:07         ` Charles Forsyth
2007-04-01 20:11           ` pedro henrique antunes de oliveira
2007-04-01 20:26             ` Charles Forsyth
2007-04-01 21:13             ` ISHWAR RATTAN
2007-04-02  1:52               ` pedro henrique antunes de oliveira
2007-04-01 12:08 erik quanstrom
2007-04-01 12:35 ` pedro henrique antunes de oliveira
2007-04-01 14:39   ` Uriel
2007-04-01 15:11   ` C H Forsyth
2007-04-01 17:35     ` pedro henrique antunes de oliveira
2007-04-01 18:05       ` erik quanstrom
2007-04-02  9:14 phao
2007-04-02  9:31 ` Anselm R. Garbe
2007-04-02  9:38   ` Charles Forsyth
2007-04-02  9:42     ` C H Forsyth
2007-04-02  9:45     ` Anselm R. Garbe
2007-04-02 12:49       ` pedro henrique antunes de oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8ded8c26ad9f3da2cf0bdf0f378ef77@plan9.bell-labs.com \
    --to=geoff@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).