Skip to content

Commit

Permalink
should close file() (#40)
Browse files Browse the repository at this point in the history
I got warnings running this about unused connection, best to explicitly close()
  • Loading branch information
MichaelChirico committed Mar 4, 2020
1 parent d97a030 commit af3d18f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions perf.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ timeit("parse_integers", parseintperf, 1000)

printfdperf = function(t) {
fd<-file("/dev/null")
on.exit(close(fd))
for (i in 1:t) {
s = sprintf("%d %d", i, i+1)
writeLines(s, fd)
Expand Down

0 comments on commit af3d18f

Please sign in to comment.