Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

3
Why does PRAW's stream_generator() use a BoundedSet limit of 301?
Post Flair (click to view more posts with a particular flair)
Post Body

Disclaimer, I am not intimately familiar with PRAW's code and there is a high chance I misunderstand things.

I have a pretty specific question about PRAW about the code shown here in the source repository. Perhaps this is best directed at one of the authors like /u/bboe.

stream_generator() uses seen_attributes = BoundedSet(301) to define the maximum amount of attributes the stream will retain when comparing to new entries called by the API.

The BoundedSet class is defined as "A set with a maximum size that evicts the oldest items when necessary."

My question is just why it is necessary to have a bounded set with length 301 when the ListingGenerator is limited to 100 with limit = 100? Since the ListingGenerator for streams like subreddit.comments will just return the chronologically most recent 100 entries, shouldn't the BoundedSet only need to be of length 100 so that it can compare against the new 100 entries (and in the process use a little less memory for constantly running streams than retaining 301 entries)?

301 just seemed like a very specific number and I was curious about the context of the decision. When running a large number of concurrent streams, I was wondering if this difference could have any significant impact on memory usage.

Thanks!

Author
Account Strength
100%
Account Age
8 years
Verified Email
Yes
Verified Flair
No
Total Karma
172,495
Link Karma
50,814
Comment Karma
117,135
Profile updated: 4 days ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago