<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>21113</bug_id>
          
          <creation_ts>2009-08-18 18:22:01 +0400</creation_ts>
          <short_desc>[FR] zsh startup time optimization</short_desc>
          <delta_ts>2010-03-12 17:23:24 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>zsh</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Shigorin">mike</reporter>
          <assigned_to name="Fr. Br. George">george</assigned_to>
          <cc>arseny</cc>
    
    <cc>evg</cc>
    
    <cc>george</cc>
    
    <cc>ktirf</cc>
    
    <cc>wrar</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>96736</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2009-08-18 18:22:01 +0400</bug_when>
    <thetext>While going through logs left by `strace -ff -o zsh.log -tt zsh` it was noticed:

17:01:24.612736 access(&quot;/home/mike/.zshrc&quot;, F_OK) = 0
17:01:24.612981 stat64(&quot;/etc/zshrc.zwc&quot;, 0xbf813570) = -1 ENOENT (No such file or directory)
17:01:24.613024 stat64(&quot;/etc/zshrc&quot;, {st_mode=S_IFREG|0644, st_size=1428, ...}) = 0
17:01:24.613096 open(&quot;/etc/zshrc&quot;, O_RDONLY|O_NOCTTY|O_LARGEFILE) = 3
17:01:24.613461 read(11, &quot;#\n# ALT Linux zshrc configuratio&quot;..., 4096) = 1428
17:01:25.406878 stat64(&quot;/home/mike/.zshrc.zwc&quot;, {st_mode=S_IFREG|0444, st_size=5336, ...}) = 0
17:01:25.406960 stat64(&quot;/home/mike/.zshrc&quot;, {st_mode=S_IFREG|0644, st_size=3801, ...}) = 0
17:01:25.407035 open(&quot;/home/mike/.zshrc.zwc&quot;, O_RDONLY|O_LARGEFILE) = 3
17:01:25.407142 read(3, &quot;\34\n\0\0\0\0\0\0&lt;\5\0\0\10\0\0\0\0\0\0\0.zshrc\0\24&quot;, 28) = 28
17:01:25.407232 open(&quot;/home/mike/.zshrc.zwc&quot;, O_RDONLY|O_LARGEFILE) = 3

To decrease zsh startup time, I propose to:

1) zcompile /etc/zshrc: there might be different ways to do that,
   probably build-time or in %post (prepackaged precompiled one is fine);
   there are also /etc/profile.d/*.sh but these are %post only and not
   %ghost&apos;able at the same time so look rather iffy;

2) move the more exotic completions into a few subpackages:
   {AIX,BSD,Cygwin,Darwin,Solaris}/ =&gt; zsh-completion-unices, and maybe
   most of Debian/, parts of {Linux,Mandriva,Redhat,Unix}/ =&gt; -linux
   X/ =&gt; x11

Or am I hunting too tiny part of a second?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96737</commentid>
    <comment_count>1</comment_count>
    <who name="Andrey Rahmatullin">wrar</who>
    <bug_when>2009-08-18 18:33:23 +0400</bug_when>
    <thetext>$ dpkg -L zsh |fgrep .zwc
/usr/share/zsh/functions/VCS_Info/Backends.zwc
/usr/share/zsh/functions/MIME.zwc
/usr/share/zsh/functions/Zle.zwc
/usr/share/zsh/functions/Zftp.zwc
/usr/share/zsh/functions/TCP.zwc
/usr/share/zsh/functions/Exceptions.zwc
/usr/share/zsh/functions/Calendar.zwc
/usr/share/zsh/functions/Completion/Solaris.zwc
/usr/share/zsh/functions/Completion/Base.zwc
/usr/share/zsh/functions/Completion/Zsh.zwc
/usr/share/zsh/functions/Completion/X.zwc
/usr/share/zsh/functions/Completion/Unix.zwc
/usr/share/zsh/functions/Completion/Mandriva.zwc
/usr/share/zsh/functions/Completion/AIX.zwc
/usr/share/zsh/functions/Completion/Debian.zwc
/usr/share/zsh/functions/Completion/Darwin.zwc
/usr/share/zsh/functions/Completion/Cygwin.zwc
/usr/share/zsh/functions/Completion/Redhat.zwc
/usr/share/zsh/functions/Completion/Linux.zwc
/usr/share/zsh/functions/Completion/BSD.zwc
/usr/share/zsh/functions/Completion.zwc
/usr/share/zsh/functions/Prompts.zwc
/usr/share/zsh/functions/VCS_Info.zwc
/usr/share/zsh/functions/Newuser.zwc
/usr/share/zsh/functions/Misc.zwc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96738</commentid>
    <comment_count>2</comment_count>
    <who name="Andrey Rahmatullin">wrar</who>
    <bug_when>2009-08-18 18:36:14 +0400</bug_when>
    <thetext># move this to a non-root section; also drop it for cross-compiles
   awk &apos;/^#define FPATH_DIR/ { head=$$3; gsub(/&quot;/,&quot;&quot;,head); }; /^#define FPATH_SUBDIRS/ { $$1=&quot;&quot;; $$2=&quot;&quot;; gsub(/[&quot; ]/,&quot;&quot;); tail=$$0; } END { printf &quot;%s/%s\n&quot;, head, tail; };&apos; obj/Src/zshpaths.h &gt;obj/Src/zshpaths.temp
   debian/tmp/bin/$(package) -fc &apos;setopt extendedglob; for i in debian/tmp/&apos;`cat obj/Src/zshpaths.temp`&apos;; do zcompile -U -M $$i.zwc $$i/*~*.zwc(^/) ; chmod 644 $$i.zwc ; done&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107738</commentid>
    <comment_count>3</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2010-03-12 16:42:50 +0300</bug_when>
    <thetext>В результате zcompile&apos;яции $fpath размер пакета увеличивается чуть более чем в два раза (на 111%).  Я считаю, что несущественый (за счёт использования autoload) прирост производительности (который так никто и не измерил) этого не стоит.  Экономить на спичечном /etc/zshrc тем более глупо.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107740</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2010-03-12 17:23:24 +0300</bug_when>
    <thetext>Я мерил, но не удалось выловить фактор, который приводил к собственно тормозам.  То есть на той же системе у нового юзера с пустым ~/.zshrc время запуска zsh было намного меньше.

Так что предлагаю по первому s/WONTFIX/NOTABUG/, а по второму -- если возникнут аргументы в виде патча, то вернёмся к ним _отдельной_ багой (&quot;отпилить динозавров, закомпилять за счёт сэкономленного базовое или хоть базовые *.zwc отдельным подпакетом).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>