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.
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!
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/redditdev/c...