Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15037
| Path | csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Peng Yu <pengyu.ut@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | JIT in bash |
| Date | Thu, 3 Jan 2019 10:02:21 -0600 |
| Lines | 75 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.6728.1546531365.1284.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1546531365 23720 208.118.235.17 (3 Jan 2019 16:02:45 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash <bug-bash@gnu.org> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=EmREeLuaveuiiMcDLYRFaYh6o3UfXu6Qfz2FKh+l0pA=; b=k3zCoEiMTkMlHZ8x7dthPZRp28BVLmyN+x/3SrQlpMSfPtRxHoGv3tOPgy7oruIhjC FsQ/fvQ0amPGUV9dJMBniBkWIm5NLm3LPjdeAWtinSW+SVDDGgZ9u8Rkd49J6se+IkoJ lcvaVbr4KWaOHRb5OCNb0pwMTqWIROShFP8osV4TQVVQ1FkwQ+qZyZtoc2Ob+ZkqCiPT Ck81IkPPxa/3vHBUnUpeGnBAwndRS8tr3Q3uyEyCBb9H2J4+AsZmaz5DY8YPW61HN6Vh DDkXYSTRI85L172wROsAewmpXzuL/A9p/uiA7fWf0L7wNXClC33BVxqP/H73lXVQQ0dn OxxA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=EmREeLuaveuiiMcDLYRFaYh6o3UfXu6Qfz2FKh+l0pA=; b=U4zWpFu0DFber9QJjla//2zgvxSGXs4eyXlbNkFgkNO9cQb+QQ462SW4f4d+UDeSsF RQ+bTkED+uouCKEilL5xg4zBYDQBHh+INhJVH5btgQILCvhwqLo1NQtO1EcE7EG9uL16 jEHqy+4wLVSKYnO3lW/VbDyTad0IjRzjTDsmC7HuWWOmUHjFFUxw4jHQDM3wGMvBjtw6 lgxxgeY70pS9EHnBhSNemuXfhqdtfvBDsKQoynaX5Buxi6CRTybIp57IsKndW8AzSvkw 6CVXGEHuJULXYex7GOCEL35sLWyZdiPxjcaHJvHw5w+VNkIoBeSTvLXbg+6WqzE6yov3 DAfA== |
| X-Gm-Message-State | AJcUukf2zn3sDHKX8HX1wZu7vV8sjRuacff6NnXXMbFrD6p08l4kOMr8 Imu7u6LR+H1eWwxerOTYFIG9rPWQwVNpzK91C7asG2ML |
| X-Google-Smtp-Source | ALg8bN6ihU73O6yn4t1ZpIq601wgr5okq2PG6gTnGTtXAn1QzkQjUWCXNeivLFjeTCG9aZqmUP83m7T4aj8qaBVEwY8= |
| X-Received | by 2002:a24:be0b:: with SMTP id i11mr9662384itf.0.1546531356178; Thu, 03 Jan 2019 08:02:36 -0800 (PST) |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:4864:20::12f |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:15037 |
Show key headers only | View raw
The following test cases show that the variable length can
significantly affect the runtime in bash. But the variable length
doesn't seem to have a significant effect in some other interpreted
languages, such as python.
I can understand that variables length will slow down the runtime, as
bash is interpreted. But I didn't expect that it should slow down the
runtime so much. Does anybody happen to know the cause of the problem
on why bash is slowed down so much compared with python when the
variable length is increased?
One way that I think can mitigate (but not solve the original problem)
the problem is to use just-in-time (JIT) compilation.
Python has a JIT compiler pypy. However, I don't see that bash has a
JIT compiler. Is it because people think that bash is just a glue
language so that making it run faster is not important, therefore
there is no need to make a JIT compiler for bash?
Or it is because the current bash code started very early and has
certain limitation which makes it hard to create a new JIT compiler
based on it?
$ cat ./main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
TIMEFORMAT=%R
set -v
time for ((i=0;i<10000;++i)); do
:
done > /dev/null
time for ((iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii=0;iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii<10000;++iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii));
do
:
done > /dev/null
time ./main.py 1000000
time ./main.py 10000000
time ./main_long.py 1000000
time ./main_long.py 10000000
$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:
import sys
for i in xrange(int(sys.argv[1])):
pass
$ ./main.sh
time for ((i=0;i<10000;++i)); do
:
done > /dev/null
0.148
time for ((iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii=0;iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii<10000;++iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii));
do
:
done > /dev/null
0.321
time ./main.py 1000000
0.188
time ./main.py 10000000
0.822
time ./main_long.py 1000000
0.164
time ./main_long.py 10000000
0.945
--
Regards,
Peng
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
JIT in bash Peng Yu <pengyu.ut@gmail.com> - 2019-01-03 10:02 -0600
csiph-web