From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: Slowdown around 5.0.5-dev-0
Date: Sat, 17 Oct 2015 11:12:28 +0200 [thread overview]
Message-ID: <CAKc7PVC3Ndge56MvcYkx4o8GE9A_0pNCwL--heOV+x2p8+uX8Q@mail.gmail.com> (raw)
In-Reply-To: <151015173554.ZM30733@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 659 bytes --]
On 16 October 2015 at 02:35, Bart Schaefer <schaefer@brasslantern.com> wrote:
> The array test only iterates 10000 times, the string test 50000 ? Does
> that not account for the difference?
Apparently not. I've modified the mem-test script so that it queries
usage of memory also during the tests. It can be seen that for strings
(and zsh 5.0.2) the memory is high from the beginning.
It can be also seen that the recent three patches increase memory
usage. A clean, free from the patches version of zsh
(5.1.1-dev-0-clean) keeps the memory always low. What's good news is
that the memory usage is lower than in 5.0.2.
Best regards,
Sebastian Gniazdowski
[-- Attachment #2: mem-test.txt --]
[-- Type: text/plain, Size: 866 bytes --]
# Tests for zsh
# string_test 453, 571, 650, 711, 758, 800, 835,
string_test 835
# array_test 2.2, 2.9, 3.5, 3.9, 4.7, 5.4, 6.4, 7.5, 7.9, 8.1, 8.6, 8.8, 8.9, 9.2, 9.4, 9.7, 10, 10, 10,
array_test 10
# Tests for zsh-head-both
# string_test 109, 238, 367, 497, 625, 8.9,
string_test 8.9
# array_test 2.1, 3, 3.5, 4, 4.7, 5.8, 6.7, 7.8, 8.2, 8.5, 8.7, 9, 9.2, 9.5, 9.7, 10, 10, 10, 10,
array_test 10
# Tests for zsh-newheaps-three-patches
# string_test 111, 245, 376, 509, 637, 8.9,
string_test 8.9
# array_test 2, 2.8, 3.7, 4.1, 4.7, 5.2, 6.2, 7.2, 7.9, 8.1, 8.4, 8.7, 8.9, 9.2, 9.4, 9.7, 10, 10, 10, 10,
array_test 10
# Tests for zsh-5.1.1-dev-0-clean
# string_test 5.7, 8, 9.5, 11, 11, 10, 10, 11, 11, 11, 12, 11, 10,
string_test 10
# array_test 2, 2.9, 3.5, 3.9, 4.3, 4.6, 5.6, 6.6, 7.3, 7.7, 8, 8.2, 8.5, 8.7, 8.9, 9.1, 9.3, 9.5, 9.7, 10, 10,
array_test 10
[-- Attachment #3: mem-test.png --]
[-- Type: image/png, Size: 89441 bytes --]
[-- Attachment #4: mem-test.zsh --]
[-- Type: application/octet-stream, Size: 3014 bytes --]
#!/bin/zsh
emulate -L zsh
setopt extendedglob
zshs=( /bin/zsh zsh-head-both zsh-newheaps-three-patches zsh-5.1.1-dev-0-clean )
# Convert sizes to number of megabytes
to_mbytes() {
local size="$1"
if [[ "$size" = [0-9]#[Mm]* ]]; then
size="${size%[Mm]*}"
elif [[ "$size" = [0-9]#[Kk]* ]]; then
size="${size%[Kk]*}"
(( size = size / 1024.0 ))
elif [[ "$size" = [0-9]# ]]; then
case $( uname ) in
*Linux*)
(( size = size / 1024.0 ))
;;
*)
(( size = size / (1024.0 * 1024.0) ))
;;
esac
else
echo "Bad size occured: $size"
fi
REPLY="$size"
}
#
# Children administration
#
trap "finished" SIGUSR1
finished() {
FINISHED=1
}
# Gets memory size of the zsh that runs the test
get_mem() {
case $( uname ) in
*Darwin*)
output=( "${(@f)"$( top -pid "$SUB_PID" -stats mem -l 1 )"}" )
to_mbytes "$output[-1]"
;;
*Linux*)
output=( "${(@f)"$( top -p "$SUB_PID" -bn 1 )"}" )
output=$output[-1]
output=( $=output )
to_mbytes "$output[6]"
;;
esac
}
# Waits for signal from child process
wait_get_mem() {
local number
echo -n "# $TEST "
while [ "$FINISHED" -eq 0 ]; do
sleep 3
get_mem
number=`LANG=C printf "%.1f" "$REPLY"`
echo -n "${number%.0}, "
done
get_mem
kill -15 "$SUB_PID"
# Suitable for gnuplot - X Y
number=`LANG=C printf "%.1f" "$REPLY"`
echo
echo "$TEST" "${number%.0}"
}
_finished_signal_wait() {
kill -SIGUSR1 "$MAIN_PID"
sleep 60
}
#
# Tests
#
tests=( string_test array_test )
string_test() {
local a=""
integer i=150000
repeat $i; do a+="$i"; done
_finished_signal_wait
}
array_test() {
typeset -a a
integer i=30000
repeat $i; do a+=( $i ); done
_finished_signal_wait
}
#
# Main code
#
# Detect main vs. for-test invocation
if [ -z "$1" ]; then
for current_zsh in "$zshs[@]"; do
type "$current_zsh" 2>/dev/null 1>&2 || { echo >&2 "Skipping non-accessible $current_zsh"; continue }
zsh_binary="${current_zsh##*/}"
echo "# Tests for $zsh_binary"
for test in "$tests[@]"; do
FINISHED=0
TEST="$test"
"$current_zsh" -c "source ./$0 $$ \"$current_zsh\" $test" &
SUB_PID=$!
wait_get_mem
done
echo
echo
done
# Example gnuplot invocation:
#set style data histogram
#set style fill solid border rgb "black"
#plot "result" index 0 using 2: xtic(1), "result" index 1 using 2: xtic(1), "result" index 2 using 2: xtic(1)
else
MAIN_PID="$1"
zsh_binary="${2##*/}"
shift
shift
# Echo status only when output is not to terminal
[ ! -t 1 ] && echo >&2 "Running [$zsh_binary]: $@"
# Run the test
eval "run_test() { $@ }"
run_test
fi
next prev parent reply other threads:[~2015-10-17 9:12 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-10 10:54 Sebastian Gniazdowski
2015-10-10 17:58 ` Bart Schaefer
2015-10-10 18:11 ` Sebastian Gniazdowski
2015-10-10 18:32 ` Sebastian Gniazdowski
2015-10-11 0:06 ` Bart Schaefer
2015-10-11 6:20 ` Bart Schaefer
2015-10-11 8:39 ` Sebastian Gniazdowski
2015-10-11 16:17 ` Bart Schaefer
2015-10-11 16:48 ` Sebastian Gniazdowski
2015-10-11 17:31 ` Bart Schaefer
2015-10-11 18:05 ` Sebastian Gniazdowski
2015-10-11 21:22 ` Bart Schaefer
2015-10-12 8:21 ` Sebastian Gniazdowski
2015-10-12 14:01 ` Bart Schaefer
2015-10-12 16:50 ` Sebastian Gniazdowski
2015-10-13 0:33 ` Bart Schaefer
2015-10-13 8:21 ` Sebastian Gniazdowski
2015-10-13 15:52 ` Bart Schaefer
2015-10-14 6:50 ` Sebastian Gniazdowski
2015-10-14 13:27 ` Peter Stephenson
2015-10-14 16:25 ` Bart Schaefer
2015-10-14 16:50 ` Bart Schaefer
2015-10-15 4:32 ` Bart Schaefer
2015-10-15 13:03 ` Sebastian Gniazdowski
2015-10-16 0:35 ` Bart Schaefer
2015-10-17 9:12 ` Sebastian Gniazdowski [this message]
2015-10-17 9:24 ` Sebastian Gniazdowski
2015-10-18 16:19 ` Bart Schaefer
2015-10-18 20:40 ` Sebastian Gniazdowski
2015-10-18 21:07 ` Bart Schaefer
2015-10-18 21:31 ` Sebastian Gniazdowski
2015-10-19 17:21 ` Bart Schaefer
2015-10-22 12:49 ` Sebastian Gniazdowski
2015-10-22 15:00 ` Bart Schaefer
2015-10-22 16:28 ` Sebastian Gniazdowski
2015-10-22 16:33 ` Sebastian Gniazdowski
2015-10-23 15:40 ` Sebastian Gniazdowski
2015-10-23 15:57 ` Sebastian Gniazdowski
2015-10-23 19:26 ` Bart Schaefer
2015-10-23 23:50 ` Bart Schaefer
2015-10-24 6:09 ` Sebastian Gniazdowski
2015-10-24 7:37 ` Sebastian Gniazdowski
2015-10-24 8:04 ` Sebastian Gniazdowski
2015-10-24 19:39 ` Bart Schaefer
2015-10-25 7:35 ` Sebastian Gniazdowski
2015-10-25 17:23 ` Bart Schaefer
2015-10-25 20:56 ` Sebastian Gniazdowski
2015-10-26 0:49 ` Bart Schaefer
2015-10-26 7:41 ` Sebastian Gniazdowski
2015-10-26 7:47 ` Sebastian Gniazdowski
2015-10-24 6:27 ` Sebastian Gniazdowski
2015-10-24 10:54 ` Sebastian Gniazdowski
2015-10-24 11:25 ` Sebastian Gniazdowski
2015-10-24 16:31 ` Bart Schaefer
2015-10-24 16:41 ` Bart Schaefer
2015-10-23 6:32 ` Sebastian Gniazdowski
2015-10-16 0:37 ` Bart Schaefer
2015-10-13 13:07 ` Sebastian Gniazdowski
2015-10-13 13:31 ` Sebastian Gniazdowski
2015-10-12 12:05 ` Sebastian Gniazdowski
2015-10-12 15:13 ` Bart Schaefer
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=CAKc7PVC3Ndge56MvcYkx4o8GE9A_0pNCwL--heOV+x2p8+uX8Q@mail.gmail.com \
--to=sgniazdowski@gmail.com \
--cc=zsh-workers@zsh.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).