Skip to content

comparing jwalk and glob #1

@amtoine

Description

@amtoine

just wanted to report some time measurements i made to test this plugin 😉

the script

Note
$env.GIT_REPOS_HOME is where is store all my Git repos

use std [assert, bench]

let jwalk = {name: "jwalk", code: { jwalk $env.GIT_REPOS_HOME }}
let glob = {name: "glob", code: { glob $"($env.GIT_REPOS_HOME)/**" }}

print --no-newline "making sure outputs are the same... "
assert equal (do $jwalk.code | sort) (do $glob.code | sort)
print "ok"

let res = [$jwalk, $glob] | each {|it|
    print $"benchmarking ($it.name)"
    $it | merge (bench --rounds 10 --verbose $it.code)
}

the results

jwalk and glob report the same 389505 files 👌

jwalk is quite a lot faster than glob 😏

> $res | select name mean std
#┬name─┬────────mean─────────┬───────std───────
0│jwalk│    610ms 292µs 458ns 31ms 417µs 956ns
1│glob │2sec 30ms 361µs 668ns│387ms 708µs 127ns
─┴─────┴─────────────────────┴─────────────────

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions