Code Monkey home page Code Monkey logo

Comments (8)

alexespencer avatar alexespencer commented on May 20, 2024 1

In the screenshot above, you can see that 0.21.0 took 60 seconds ish to run. The 0.18.0 code took just 2 seconds. Code to reproduce this is attached above. I just used python 3.7, and in two different environs had 0.21.0 and 0.18.0. This was spotted during a huge performance slow down in our kubernetes cluster - I have now locked the version (should have done that before, that's on me) - but thought you would want to know about this in case it's fixable.

from python-benedict.

alexespencer avatar alexespencer commented on May 20, 2024

I removed the "get" of missing elements and it still takes a long time - I wondered if it might just be that bit that's slow, but it still took the same time. Ideally the timer would only start after the dictionary has been created too - so I reran the test and 0.21.0 took 30 seconds - so perhaps both setting and getting is affected?

from python-benedict.

fabiocaccamo avatar fabiocaccamo commented on May 20, 2024

@alexespencer thank you for reporting this, I'm confident that this slowdown is caused by the base layer introduced here.

from python-benedict.

alexespencer avatar alexespencer commented on May 20, 2024

@fabiocaccamo was that from 0.20.0? I just double checked 0.19.0 and that's all good, the slow down starts from 0.20.0

from python-benedict.

fabiocaccamo avatar fabiocaccamo commented on May 20, 2024

Yes, it has been released in 0.20.0 
Do you pass an existing dict to the constructor or you start with an empty dict?

from python-benedict.

alexespencer avatar alexespencer commented on May 20, 2024

@fabiocaccamo in the test code above I start with an empty one, passing "benedict({})" to initialise it, then populate via .set. However, in our production code we usually read JSON into a dict, then pass that in.

from python-benedict.

fabiocaccamo avatar fabiocaccamo commented on May 20, 2024

@alexespencer I figured out the problem, it is the automatic casting to benedict of retrieved dict values.

The problem occurs because some internal utilities call methods like __getitem__ or get (for example this one) that potentially could return dict values that will be casted to benedict.

from python-benedict.

fabiocaccamo avatar fabiocaccamo commented on May 20, 2024

@alexespencer You can upgrade to 0.21.1 version.

from python-benedict.

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.