Skip to content

Commit

Permalink
Merge pull request #8 from AmjadHD/patch-1
Browse files Browse the repository at this point in the history
Some minor changes
  • Loading branch information
treeform authored Dec 15, 2021
2 parents 5470d47 + bfd75cb commit 6c11b45
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/benchy.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ proc total(s: seq[SomeNumber]): float =
proc min(s: seq[SomeNumber]): float =
## Computes mean (average) of a sequence.
result = s[0].float
for v in s[1 .. ^1]:
result = min(v.float, result)
for i in 1..s.high:
result = min(s[i].float, result)

proc mean(s: seq[SomeNumber]): float =
## Computes mean (average) of a sequence.
Expand Down Expand Up @@ -41,8 +41,8 @@ proc removeOutliers(s: var seq[SomeNumber]) =
while i < s.len:
if abs(s[i] - avg) > std*2:
s.delete(i)
continue
inc i
else:
inc i

var
shownHeader = false # Only show the header once.
Expand All @@ -56,10 +56,9 @@ template keep*(value: untyped) =
keepInt = keepInt and 0xFFFF
#keepInt = cast[int](value)

proc dots(n: int): string =
template dots(n: Natural): string =
## Drop a bunch of dots.
for i in 0 ..< n:
result.add(".")
repeat('.', n)

template timeIt*(tag: string, iterations: untyped, body: untyped) =
## Template to time block of code.
Expand Down

0 comments on commit 6c11b45

Please sign in to comment.