Code Monkey home page Code Monkey logo

Comments (4)

garfr avatar garfr commented on July 16, 2024

If we are not going to give the queue implementation its own directory, should we put it in a utils directory, or should we just place it in the socket_tcp_manager folder for simplicity's sake?

Is the implementation just going to store a typeless pointer to the object, or should we also give it a certain size and have the queue structure actually contain the data?

from simple-http-server.

bama4 avatar bama4 commented on July 16, 2024

My thought is that queue, hashmap, task struct would all be in one utils folder.
This may also make the project more structured when we add the unit test code and add a run tests option to the build.

So I have seen queue structures in C implemented as a linked list. This would help to keep track of size and for later deletion. In this scenario, each node would just have a pointer to void * data.

from simple-http-server.

garfr avatar garfr commented on July 16, 2024

From an algorithms point of view, a singly linked list should be the best for the queue, as long as we just hold a pointer to the head and tail. Then insertion to the back and deletion from the front is O(1).

There is also a chance that a resizable array could utilize cache locality better, but that would require some benchmarking to see if that works out in our case.

from simple-http-server.

bama4 avatar bama4 commented on July 16, 2024

From an algorithms point of view, a singly linked list should be the best for the queue, as long as we just hold a pointer to the head and tail. Then insertion to the back and deletion from the front is O(1).

There is also a chance that a resizable array could utilize cache locality better, but that would require some benchmarking to see if that works out in our case.

Yes I think for our purposes the queue will be fine. We can always improve later

from simple-http-server.

Related Issues (13)

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.