Git Product home page Git Product logo

Comments (1)

RandyGaul avatar RandyGaul commented on August 31, 2024

That could definitely work, however adding another parameter to the user-facing API just to support a slight optimization is probably not a very good way to go about it. The API is usually of utmost priority. Instead, internally, the kind of body can be read, and if static perhaps an optimization could be made.

However, this optimization may not actually save any time simply due to the extra cost of checking the flag.

Additionally, modifying any of the code is in and of itself a risk, since new bugs can potentially be introduced.

Not to say your suggestion is a bad idea at all; you're correct that a potential optimization here exist. It would just need to be qualitatively decided whether or not adding such a modification outweighs the costs. Costs namely being:

  • Changing APIs and adding parameters should be viewed as extremely costly. APIs are of utmost importance, since they are user facing and directly affect user experience.
  • Is the change likely to introduce new bugs?
  • Is the optimization going to really be any faster than the cost of extra if-statements?
  • Is this optimization going to be solving any bottlenecks? If this optimization does not address a bottle-neck, the performance benefit (if any) may be impossible to realized in practice.

In any case, I'd be willing to take a look at a pull request :)

Closing this for now, but feel free to comment or ask more questions here. We can re-open it if we need to.

from qu3e.

Related Issues (20)

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.