Skip to content

Example of slowness compared to Bash (while or test problem?) #2007

@alphapapa

Description

@alphapapa

This is relatively quick:

locate $HOME | bash -c 'while read dir; do [[ -d $dir ]] && echo $dir; done'

But this is painfully slow:

function onlyDirs
    while read dir
        test -d $dir; and echo $dir
    end
end

locate $HOME | onlyDirs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions