Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix #184 * update unit tests * fix branch for http integration tests
- Loading branch information
1 parent
b499f87
commit abb08ae
Showing
4 changed files
with
96 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import sys | ||
import time | ||
|
||
import smart_open | ||
|
||
open_fn = smart_open.smart_open | ||
# open_fn = open | ||
|
||
def report_time_iterate_rows(file_name, report_every=100000): | ||
start = time.time() | ||
last = start | ||
with open_fn(file_name, 'r') as f: | ||
for i, line in enumerate(f, start=1): | ||
if not (i % report_every): | ||
current = time.time() | ||
time_taken = current - last | ||
print('Time taken for %d rows: %.2f seconds, %.2f rows/s' % ( | ||
report_every, time_taken, report_every / time_taken)) | ||
last = current | ||
total = time.time() - start | ||
print('Total: %d rows, %.2f seconds, %.2f rows/s' % ( | ||
i, total, i / total)) | ||
|
||
report_time_iterate_rows(sys.argv[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters