From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: Peter Schay Message-ID: <3AF8C3CC.88BBAE0C@pobox.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [9fans] env walk optimization Date: Wed, 9 May 2001 08:30:01 +0000 Topicbox-Message-UUID: 9bff240a-eac9-11e9-9e20-41e7f4b1d025 Hello, Here's more on the performance subject; I hope the following optimization is useful and not too inelegant. The algorithm for walking in #e seems to be O(n*n). I think it's pretty easy to make it O(n). For example, on my system the following script takes no time with 42 environment variables takes 4 seconds with 441 vars: term% time /fd/0 <<. #!/bin/rc rfork e eval X^(`{seq 1})^('=1') echo nvars `{ls /env | wc -l}