Closed typescriptstudies closed 5 years ago
There are 2,216 titled players and up to 40,000 online players.
I'm not aware how things are implemented, but if online players are kept in memory and titled players require database query, then fetching online titled from memory may be faster.
It's not. Fetching 40,000 players is slower than fetching 2216.
https://lichess.org/api/users/titled?titles=BOT,GM,WGM,IM,WIM,FM,WFM,CM,WCM,NM,WNM,LM&online=true
The above request was intended to query all online titled players. When tested it returned 74 players ( 5 kB in size ). Yet it took a long time for it to load, on the order as if I have requested all titled players regardless of online status ( which is 2216 players, more than 100 kB in size ).
However the below query is very fast ( note that there are only 2 WNMs ):
https://lichess.org/api/users/titled?titles=WNM&online=true
The documentation on the real time users API ( https://lichess.org/api#operation/apiUsersStatus ) says that this API is cheap on lichess side. So there must be a way to return online titled players faster ( I mean do the search based on online players and fetch titled out of them, rather than fetching all titled players and see which are online ).