Code Monkey home page Code Monkey logo

Comments (1)

johnezang avatar johnezang commented on September 23, 2024

Some of this is covered in CHANGELOG.md, but the short explanation is that this implements a "transfer of ownership" memory management policy.

The normal object ownership flow for collections usually has the collection CFRetain an object when it is added to the collection via a AddToCollection type of call. Once added to the collection, whatever added it to the collection must call CFRelease in order to balance things out.

With a "transfer of ownership" type of policy, the collection omits the CFRetain, and the whatever is adding the object to the collection omits the CFRelease. The retain counts balance out to be the same, with two fewer retain / release calls.

Since the number of objects that JSONKit creates tends to be a lot, eliminating these calls actually improves performance. Part of the reason why it results in a performance increase is because the retain and release calls (for the types of objects JSONKit creates) are implemented with atomic CPU primitives, which have a tendency to be "very expensive" to execute.

from jsonkit.

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.