zsh-users
 help / color / mirror / code / Atom feed
* One glob (*cbp) slow, other (*1000) fast, why?
@ 2016-09-08  8:47 Sebastian Gniazdowski
  2016-09-08  9:06 ` Sebastian Gniazdowski
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2016-09-08  8:47 UTC (permalink / raw)
  To: Zsh Users

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

Hello,
on a directory with 80000 files (result of touch {1..2000} {1..2000}{a..c})
I do:

typeset -F SECONDS; myst=$SECONDS; tmp=( *cbp(NY1) ); echo $(( (SECONDS -
myst) * 1000 ))

it returns: 80.449999999927968

then I do:

typeset -F SECONDS; myst=$SECONDS; tmp=( *1000(NY1) ); echo $(( (SECONDS -
myst) * 1000 ))

it returns: 0.15299999995477265

Why such a difference?


More:

typeset -F SECONDS; myst=$SECONDS; tmp=( *10000(NY1) ); echo $(( (SECONDS -
myst) * 1000 ))
0.2779999999802385
typeset -F SECONDS; myst=$SECONDS; tmp=( *100000(NY1) ); echo $(( (SECONDS
- myst) * 1000 ))
78.060000000277796

I.e. it starts to be slow at 5 or more zeros.

Best regards,
Sebastian Gniazdowski

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

* Re: One glob (*cbp) slow, other (*1000) fast, why?
  2016-09-08  8:47 One glob (*cbp) slow, other (*1000) fast, why? Sebastian Gniazdowski
@ 2016-09-08  9:06 ` Sebastian Gniazdowski
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Gniazdowski @ 2016-09-08  9:06 UTC (permalink / raw)
  To: Zsh Users

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

Ah, it's obvious, I've forgot what NY1 does, returns after first match.. :)

Best regards,
Sebastian Gniazdowski


On 8 September 2016 at 10:47, Sebastian Gniazdowski <sgniazdowski@gmail.com>
wrote:

> Hello,
> on a directory with 80000 files (result of touch {1..2000}
> {1..2000}{a..c}) I do:
>
> typeset -F SECONDS; myst=$SECONDS; tmp=( *cbp(NY1) ); echo $(( (SECONDS -
> myst) * 1000 ))
>
> it returns: 80.449999999927968
>
> then I do:
>
> typeset -F SECONDS; myst=$SECONDS; tmp=( *1000(NY1) ); echo $(( (SECONDS -
> myst) * 1000 ))
>
> it returns: 0.15299999995477265
>
> Why such a difference?
>
>
> More:
>
> typeset -F SECONDS; myst=$SECONDS; tmp=( *10000(NY1) ); echo $(( (SECONDS
> - myst) * 1000 ))
> 0.2779999999802385
> typeset -F SECONDS; myst=$SECONDS; tmp=( *100000(NY1) ); echo $(( (SECONDS
> - myst) * 1000 ))
> 78.060000000277796
>
> I.e. it starts to be slow at 5 or more zeros.
>
> Best regards,
> Sebastian Gniazdowski
>
>

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

end of thread, other threads:[~2016-09-08 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08  8:47 One glob (*cbp) slow, other (*1000) fast, why? Sebastian Gniazdowski
2016-09-08  9:06 ` Sebastian Gniazdowski

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