zsh-users
 help / color / mirror / code / Atom feed
* Optimized by doing $var instead of "$var", but does this vary to some extent?
@ 2018-08-06 12:43 Sebastian Gniazdowski
  2018-08-06 14:05 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2018-08-06 12:43 UTC (permalink / raw)
  To: Zsh Users

Hello,
I just gained 60 ms (out of ~3300 ms) by replacing my paranoia-quoting
of everything i.e. [[ "$var" = "1" ]] with unquoted,
noshwordsplit-trusting [[ $var = "1" ]]. But I did this about a year
ago too in different project, and after promising initial results
things turned out to become slower. There were more array uses there,
mostly "${arr[@]}", but my tests were superficial.

Now after replacing half of code, I managed to get gain ~100 ms. Now
after replacing everything, zprof yields only 60 ms. I run zprof many
times and note shortest time, so it can be just luck.

But maybe some quotings are slowing down and some helping? Does
someone know Zsh code to hint that sometimes quoting in "$var"-like
way can help performance?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Optimized by doing $var instead of "$var", but does this vary to some extent?
  2018-08-06 12:43 Optimized by doing $var instead of "$var", but does this vary to some extent? Sebastian Gniazdowski
@ 2018-08-06 14:05 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2018-08-06 14:05 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

On Mon, Aug 6, 2018, 7:44 AM Sebastian Gniazdowski <sgniazdowski@gmail.com>
wrote:

>
> But maybe some quotings are slowing down and some helping? Does
> someone know Zsh code to hint that sometimes quoting in "$var"-like
> way can help performance?
>

My guess would be that it has something to do with array handling and
memory allocation, so e.g. the sooner you can force an array to become a
string (if eventually it will be treated as one) the better -- but this is
just a guess.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-06 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-06 12:43 Optimized by doing $var instead of "$var", but does this vary to some extent? Sebastian Gniazdowski
2018-08-06 14:05 ` Bart Schaefer

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).