listfiles

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2018 License: MIT Imports: 14 Imported by: 1

README

listfiles

List files recursively, requires cgo.

There are three methods here, it seems one of them is much better on Windows and one is much better on Linux (no tests on OSX). Neither of the better methods if the std filepath.Walk (StdLib).

Benchmarks

On Windows (8-core) with ntfs-formatted SSD and tens of thousands files:

  • ListFilesUsingC: 132 seconds
  • ListStdLib: 24 seconds
  • ListInParallel: 1.8 seconds

On Linux (8-core) with ext4-formatted SSD and a million files:

  • ListFilesUsingC: 5.1 seconds
  • ListStdLib: 5.5 seconds
  • ListInParallel: 7.2 seconds

On Linux (8-core) with xfs-formatted 7200rpm disk and hundred thousand files:

  • ListFilesUsingC: 1.8 seconds
  • ListStdLib: 3.0 seconds
  • ListInParallel: 3.9 seconds

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Path    string
	Size    int64
	Mode    os.FileMode
	ModTime time.Time
	IsDir   bool
	Hash    uint64 `hash:"ignore"`
}

File is the object that contains the info and path of the file

func ListFiles

func ListFiles(dir string) (files []File, err error)

func ListFilesGodirwalk

func ListFilesGodirwalk(dir string) (files []File, err error)

func ListFilesRecursively

func ListFilesRecursively(dir string) (files []File, err error)

ListFilesRecursively uses filepath.Walk to list all the files

func ListFilesRecursivelyInParallel

func ListFilesRecursivelyInParallel(dir string) (files []File, err error)

ListFilesRecursivelyInParallel uses goroutines to list all the files

func ListFilesUsingC

func ListFilesUsingC(dir string) (files []File, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL