the-algorithm icon indicating copy to clipboard operation
the-algorithm copied to clipboard

Make an optimization for BatchingClient

Open xxDark opened this issue 2 years ago • 3 comments

This optimization avoids allocation of new hash table on each batch being sent by using an array storing original content of requests to send. Not sure how often this code path is taken, but based off of the comment left originally, I decided to make this. Not sure whether this is possible since I don't know which type GetTweetsRequest#setTweet_ids accepts as the parameter and how its fields are serialized (I assume its parameter is a plain List, not an ArrayList specifically).

xxDark avatar Apr 01 '23 00:04 xxDark

Does this PR help Elon pay off 44 billion? If so, merge. If not, merge anyways and let's see what happens.

abetwothree avatar Apr 01 '23 01:04 abetwothree

Maybe they need it ordered: https://stackoverflow.com/questions/1035008/what-is-the-difference-between-set-and-list

ludo6577 avatar Apr 01 '23 02:04 ludo6577

Maybe they need it ordered: https://stackoverflow.com/questions/1035008/what-is-the-difference-between-set-and-list

Hashset was used in the first place which is not ordered by definition

xxDark avatar Apr 01 '23 14:04 xxDark