[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non working code .. loop ends after one
From: |
alex xmb ratchev |
Subject: |
Re: non working code .. loop ends after one |
Date: |
Fri, 3 Mar 2023 10:31:27 +0100 |
On Thu, Mar 2, 2023, 8:41 PM Kerin Millar <kfm@plushkava.net> wrote:
> On Thu, 2 Mar 2023 08:52:15 +0100
> alex xmb ratchev <fxmbsw7@gmail.com> wrote:
>
> > On Thu, Mar 2, 2023, 3:05 AM Kerin Millar <kfm@plushkava.net> wrote:
> >
> > > On Thu, 2 Mar 2023 00:07:55 +0100
> > > alex xmb ratchev <fxmbsw7@gmail.com> wrote:
> > >
> > > > i used declare [-a] "<definition>' to make bash parse the \<code>
> > >
> > > For this, you could use printf.
> > >
> >
> > yes yes , but my argument is declare is faster .. even if for this app /
>
> $ unset -v sep; time for ((i = 0; i <= 500000; i++)); do sep='\n'; printf
> -v sep %b "$sep"; done
> real 0m3.932s
> user 0m3.924s
> sys 0m0.000s
>
> $ unset -v sep; time for ((i = 0; i <= 500000; i++)); do sep='\n'; declare
> -a "sep=( $'$sep' )"; done
> real 0m5.212s
> user 0m5.203s
> sys 0m0.000s
>
> $ unset -v sep; time for ((i = 0; i <= 500000; i++)); do sep='\n'; [[ $sep
> == *\\* ]] && declare -a "sep=( $'$sep' )"; done
> real 0m6.299s
> user 0m6.288s
> sys 0m0.000s
>
thats for me very important benchmarking
ill switch to printf
i used to benchmark but u see its not enuff :))
thanks mate
.. xmb
--
> Kerin Millar
>
- Re: non working code .. loop ends after one, (continued)
- Re: non working code .. loop ends after one, alex xmb ratchev, 2023/03/01
- Re: non working code .. loop ends after one, alex xmb ratchev, 2023/03/01
- Re: non working code .. loop ends after one, alex xmb ratchev, 2023/03/01
- Re: non working code .. loop ends after one, Kerin Millar, 2023/03/01
- Re: non working code .. loop ends after one, alex xmb ratchev, 2023/03/02
- Re: non working code .. loop ends after one, Kerin Millar, 2023/03/02
- Re: non working code .. loop ends after one, Greg Wooledge, 2023/03/02
- Re: non working code .. loop ends after one, alex xmb ratchev, 2023/03/03
- Re: non working code .. loop ends after one,
alex xmb ratchev <=
Re: non working code .. loop ends after one, alex xmb ratchev, 2023/03/01
Re: non working code .. loop ends after one, Chet Ramey, 2023/03/01