Commit 083cc989 authored by Jed Simson's avatar Jed Simson

Removed benchmarking scratchpad file

parent 99c54a15
import praw
from praw.helpers import submissions_between
from search import Search
import time
LOW = 1466424000
HIGH = 1466510400
def time_praw():
r = praw.Reddit('/u/oracular_demon tests')
submissions = []
t0 = time.time()
for submission in submissions_between(r, 'askreddit', verbosity=0, \
lowest_timestamp=LOW, highest_timestamp=HIGH):
submissions.append(submission)
t1 = time.time()
print('\n{} submissions found between {} and {}.'.format(len(submissions), LOW, HIGH))
print('Time elapsed: {} seconds'.format(t1 - t0))
return submissions
def time_search():
s = Search()
submissions = []
t0 = time.time()
for submission in s.generate('askreddit', LOW, HIGH, sort='new', limit=500):
submissions.append(submission)
t1 = time.time()
print('\n{} submissions found between {} and {}.'.format(len(submissions), LOW, HIGH))
print('Time elapsed: {} seconds'.format(t1 - t0))
return submissions
if __name__ == '__main__':
print('Testing submissions between using PRAW API Helper...')
submissions1 = time_praw()
print('\nTesting submissions between using my search API...')
submissions2 = time_search()
length = min(len(submissions1), len(submissions2))
# Only go as far as the smallest result
for i in range(length):
submission1 = submissions1[i]
submission2 = submissions2[i]
print('{}.\t {} == {} => {}'.format(i, submission1.id, submission2.id, submission1.id==submission2.id))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment