Giter Club home page Giter Club logo

dyte-hiring-challenge-solution's Introduction

Dyte Hiring Challenge Submission

Implemented BenchmarkSample function in the most efficient way possible to my current knowledge.

Solution Approach (Description)

After understanding the code and problem, I identified operations to improve performance and efficiency to some extent. By leveraging my programming skills, I realized that some precomputation may be useful.I have taken reference of BenchmarkRawUDP function and have made following changes :

  • Precomputing connections instead of building connection for each writer function call (i.e. b.N times).

  • Instead of sending UDP packets sequencially now we are sending concurrently utilizing goroutines.

Result i got as compared to BenchmarkRawUDP function (Baseline Implementation) are following in order :

  • Number of iterations per second - Almost 2 times better.
  • Time for processing each iteration - Almost 1.85 times better.
  • Bytes allocated per iteration - Bit better.
  • Number of allocations per iteration - Bit better.

Screenshot from 2024-03-30 23-43-14

Trade-offs

  • We are not caring about the order in which each reader receiving messages.
  • Increased resource usage, as each thread requires its own set of resources such as memory and CPU time.
  • Precomputing the connection pool improves performance by reducing latency since connections are established beforehand. However, Preallocation of resources may not be suitable for scenarios where the number of connections ( readersCount ) varies dynamically.

dyte-hiring-challenge-solution's People

Contributors

dhakad22klx avatar

Watchers

 avatar

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.