Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6653913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:19:39+00:00 2026-05-26T01:19:39+00:00

I am using NetworkX to process large graphs. I want to serialize/deserialize those graphs,

  • 0

I am using NetworkX to process large graphs. I want to serialize/deserialize those graphs, and I can do that efficiently using cPickle. However, I noticed a performance penalty when I use delegation instead of inheritance, for example:

class A:
   def __init__(self, **kwargs):
      self.graph = Digraph()

class A(DiGraph):
   def __init__(self, **kwargs):
      DiGraph.__init__(self, **kwargs)

Later at some point, I use cPickle.loads to retrieve the graph and load it into memory. I benchmarked the loading times and the delegation-style graph is loaded 2 times slower than the inheritance style. Performance is an issue for me, and I was wondering why does this happen..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:19:40+00:00Added an answer on May 26, 2026 at 1:19 am

    Delegation means you have twice the number of objects.

    Without inheritance, the serialized format looks like this:

    A       {graph: [pointer +1]}
    Digraph {name:'mygraph', nodes:..., edges:...}
    

    With inheritance, it’s more like:

    A       {name:'mygraph', nodes:..., edges:...}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We run a nightly process that generates a large number (~8000) of reports each
I have a service that scans network folders using a parallel.for method. However recently
Can we use mp3 files for the voice recognition process without using wav files?
I want to FTP some files across networks using Windows FTP command prompt and
I want to transfer files across the network using C or C++. What topics
I really like how I can easily share files on a network using the
How can I detect all WiFi networks availables using Delphi? (source: filebuzz.com )
I have a server process bound to a port that receives network packets at
I work for a large organization that supports many different sites on a nation
I'm designing a server daemon for a project that has to take a large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.