Skip to content

Measuring and optimizing try's overhead #156

@ezrizhu

Description

@ezrizhu

Below loop takes 0.086338005s

try/try

Lines 109 to 117 in 55a7619

while IFS="" read -r mountpoint
do
## Only make the directory if the original is a directory too
if [ -d "$mountpoint" ] && ! [ -L "$mountpoint" ]
then
# shellcheck disable=SC2174 # warning acknowledged, "When used with -p, -m only applies to the deepest directory."
mkdir -m "$(stat -c %a "$mountpoint")" -p "${SANDBOX_DIR}/upperdir/${mountpoint}" "${SANDBOX_DIR}/workdir/${mountpoint}" "${SANDBOX_DIR}/temproot/${mountpoint}"
fi
done <"$DIRS_AND_MOUNTS"

each unionhelper mount takes around 0.011723267s
each normal overlay mount takes around 0.005518701s

0.004118806 Entrypoint
0.001737423 Finish Parseopt
0.001615350 Start of try()
0.003911111 Determining sandboxdir
0.009549844 Docker handling
0.004255040 Making upperdir, workdir, temproot
0.004132450 Enumerating direcotories to mount
0.006334729 EnumDir: find
0.006502962 EnumDir: findmnt
0.003777117 EnumDir: sort
0.005552995 EnumDir: MultiLowerDir
0.084236389 Prepare sandboxes before unshare
0.005717082 set temproot permission
0.016709205 Writing tempfiles
0.001816768 Disable job control
0.005136067 Outer unshare
0.001934788 Union helper detection
0.105242101 Mounting overlays
0.030229675 Mounting devices
0.012676495 Inner unshare
0.009892223 sync
0.029609429 unmounting devices
0.011026003 Exitting inner unshare
0.019649394 Symlinks cleanup
0.008201226 Summary
0.001717618 End of try
0.001631593 date test 1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions