Algolisted-Org / AlgoListed

Algolisted is an AI-powered platform dedicated to assisting computer science students in preparing for placements and internships. Our services include tracking and analytics across various platforms and topics.
http://algolisted.com
Other
163 stars 99 forks source link

Contest Analysis Page Hangs a Lot! #113

Closed NayakPenguin closed 1 year ago

NayakPenguin commented 1 year ago

The contest analysis page is currently experiencing slowdowns because it calls a rather resource-intensive API and involves a lot of canvas work with Chart.js.

I'm actively seeking a solution to address this issue.

#help-required

@jatingodnani please have a look!

jatingodnani commented 1 year ago

I think code splitting will work.need to decrease api calls

NayakPenguin commented 1 year ago

Can we get on a google meet for 2 mins?

jatingodnani commented 1 year ago

I will today read the whole code.we can schedule meet tomm

NayakPenguin commented 1 year ago

Ok sure, do let me know the timings.

jatingodnani commented 1 year ago

Can you pls tell me is that you are calling the api for data to use in chartjs everytime when page load

NayakPenguin commented 1 year ago

YES!

jatingodnani commented 1 year ago

Beacuse same api calling and giving same result .we need to use useMemo or callback for optimization

NayakPenguin commented 1 year ago

Ok, but the API parameters matter as well! like the particular contest we are looking for - can we manage that?

jatingodnani commented 1 year ago

Yes,suppose if we are calling contest 361 api frequently.if use usememo we can already store the data in this

NayakPenguin commented 1 year ago

Ok sure, I think we can do this!

jatingodnani commented 1 year ago

useMemo is not a ssolution,should i do code splitting and break the code into pieces?

NayakPenguin commented 1 year ago

useMemo is not a ssolution,should i do code splitting and break the code into pieces?

Yeah sure! @jatingodnani However, I'd like to make a few adjustments before pushing the code. I'll notify you as soon as I've completed them, which should be within the next hour. Additionally, as I mentioned yesterday, this is a complex issue, and I think it would be beneficial to have a discussion on Google Meet. Could you please let me know your availability for scheduling a meeting?

jatingodnani commented 1 year ago

To be honest,i dont understand why it is hapenning because in code we only calling two api

NayakPenguin commented 1 year ago

The API is very heavy! If you call it on Postman or something you will realize that. But since the API is made by me on the flask, I can make some required changes as well! That's why wanted a discussion - but if you are busy then it's fine. No issues.

jatingodnani commented 1 year ago

I am currently present in collage,will do meet at night. So this is not official leetcode api how to get the data from leetcode

NayakPenguin commented 1 year ago

I am currently present in collage,will do meet at night. So this is not official leetcode api how to get the data from leetcode

Sure, that sounds good. Let's schedule a meeting for tonight.

You're absolutely right; this isn't the official LeetCode API since they don't offer this data. I've customized it myself using Python's Flask and a few other technologies.

jatingodnani commented 1 year ago

You are scrapping data from leetcode??if yes,then whivh tool you are using

NayakPenguin commented 1 year ago

Actually, my friend @sailikpandey22 is doing it, I think he is using python beautiful soup and a few other stuff!

NayakPenguin commented 1 year ago
Screenshot 2023-10-06 at 2 03 21 AM

@jatingodnani I investigated why this issue was happening and found, that the pull request you submitted included some code that was causing an infinite loop. However, after I made the change of replacing [retrivelocalstorage] with an empty [], the issue with the infinite loop was resolved. As a result, we no longer experience any hanging or freezing. :)