Skip to content

Commit

Permalink
Update benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkTiedemann committed Oct 4, 2018
1 parent 78c20af commit 3bf0392
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
fastlist.exe
fastlist.obj
timeit.dat
fastlist.*
timeit.*
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# fastlist

**Like `tasklist`, but 4x faster.**
**Like `tasklist`, but 5x faster.**

```
Name Process Time System Calls Context Switches Page Faults Total I/O
fastlist 0:00:00.035 8217 1556 4752 176917
tasklist 0:00:00.141 62314 26919 4927 1346001
Name Process Time System Context Page Total I/O
Calls Switches Faults
fastlist 0:00:00.031 7933 1571 4693 174322
tasklist 0:00:00.148 71404 28577 6773 1606046
```

## Development

- **Install dependencies:** <code><a href="https://scoop.sh/">scoop</a> install visualc rktools2k3</code>
- **Build binary**: <code><a href="https://msdn.microsoft.com/en-us/library/610ecb4h.aspx">cl</a> fastlist.cpp</code>
- **Run benchmark**: [`bench`](bench.cmd)
- **Run benchmark**: <code><a href="https://github.com/MarkTiedemann/fastlist/blob/master/bench.cmd">bench</a> 100</code>

## License

Expand Down
31 changes: 27 additions & 4 deletions bench.cmd
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
@echo off
setlocal enabledelayedexpansion
set /a runs = 24

:: determine run count (either first argument or 100 by default)
set "runs="&for /f "delims=0123456789" %%i in ( "%1" ) do set runs=%%i
if defined runs (
set /a runs = 100
) else (
if "%1" == "" ( set /a runs = 100 ) else ( set /a runs = %1 )
)

:: cleanup temp files
if exist timeit.dat del timeit.dat
if exist timeit.res del timeit.res
if exist timeit.cnt del timeit.cnt

:: get carriage return
for /f %%r in ( 'copy /Z %~f0 nul' ) do set cr=%%r

for /l %%i in ( 1, 1, !runs! ) do (
:: print progress
< nul set /P = # %%i / !runs! !cr!

:: run benchmark
timeit tasklist > nul 2>&1
timeit fastlist > nul 2>&1
)

:: count excluded runs
timeit -d -t > timeit.res 2>&1
findstr EXCL timeit.res | find /c /v "@" > timeit.cnt
for /f "delims=" %%x in ( timeit.cnt ) do set excl=%%x
set /a excl = %excl% / 2

:: print results
echo.
echo.
timeit -t
echo.
set /a excl = !runs! - !runs! / 5 * 4
echo !excl! runs excluded
echo.
echo !excl! runs excluded each

0 comments on commit 3bf0392

Please sign in to comment.