[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?
From: |
Mattias Engdegård |
Subject: |
bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations? |
Date: |
Thu, 9 Jul 2020 12:20:34 +0200 |
9 juli 2020 kl. 00.19 skrev Andrea Corallo <akrl@sdf.org>:
> Or is it maybe that the only way to certainly have a mutable string is
> with `copy-sequence' or `make-string'?
Yes; since the need for a mutable value is very unlikely, creating a fresh copy
every time just in case would be a big waste of resources. Otherwise, we could
only 'optimise'
(concat "abc" "def")
to
(copy-sequence "abcdef")
which would be a very modest improvement, for very little gain.
The two functions you mentioned are indeed guaranteed to return fresh, mutable
strings and thus cannot be marked 'pure'.
String mutation is something of a special case: it is rare, yet its mere
possibility incurs costs even for code that doesn't use it. Better try to keep
that cost to a minimum.
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, (continued)
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/05
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Mattias Engdegård, 2020/07/06
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/06
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Mattias Engdegård, 2020/07/07
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/07
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Mattias Engdegård, 2020/07/07
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/07
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/08
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Mattias Engdegård, 2020/07/08
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/08
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?,
Mattias Engdegård <=
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Stefan Monnier, 2020/07/09
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/09
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Stefan Monnier, 2020/07/09
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Paul Eggert, 2020/07/09
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Andrea Corallo, 2020/07/09
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Mattias Engdegård, 2020/07/05
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Paul Eggert, 2020/07/03
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Mattias Engdegård, 2020/07/03
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Paul Eggert, 2020/07/04
- bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?, Eli Zaretskii, 2020/07/04