Giter VIP home page Giter VIP logo

repostcheckerbot's People

Contributors

a1igator avatar chrisryancombs avatar nip5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

repostcheckerbot's Issues

Avoid cpu hogging

In your last commit (49469f8) you might have missed this loop

https://github.com/xXAligatorXx/RepostCheckerBot/blob/d43b314d874f78e695f49b7c4f5b7e4063cc6a2c/database.py#L250-L266

The applied fix to add a sleep will solve the immediate issue. The proper way to handle tasks is to use a task/event scheduler (https://docs.python.org/3/library/sched.html#). If you want to repeatedly run them make sure the task reschedules itself. This way you have more control over, can cancel it at any time, and still execute it even if an exception is thrown in the function.

A second improvement you can implement, if you want t really clean code, do not run the delete task in a fixed delay loop but rather just as necessary. You can retrieve the oldest/newest time in the sql query and compute the next time a deletion operation is necessary and schedule the appropriate task right away.

https://github.com/xXAligatorXx/RepostCheckerBot/blob/d43b314d874f78e695f49b7c4f5b7e4063cc6a2c/app.py#L43

Make Code More Efficient for Reddit RepostCheckerBot!!!

Hello,

As I will be making the bot public and very easy to add into any subreddit, I require for it to be able to handle 1000s of posts a minute, and it is just not fast enough for that yet. I have exhausted my knowledge of efficiency in Python, sqlite, and video and image hashing.

I would very much appreciate it if you may help me make the code more efficient in any of those areas. I believe the sqlite implementation is the area that could be improved the most due to the amount of statements that I have.

Most of the slow parts of the code are in database.py . The set up has been explained in the readme. Please make a comment if you are interested or have any questions/problems or even if you believe the code is as efficient as it can be.

Thanks for reading!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.