Python Forum
What work faster and take less memory array or class?
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What work faster and take less memory array or class?
#1
Hello.
I use Python 2.7

What the deference in time and space complexity between using classes and arrays?
I have class A. Class A have not any methods, only container of fields.
And map of instance of class A. Let it be m1. 

Also I have array which contains same data as fields of class A
and map m2 with instance of such arrays.


number of instances in m1 and m2 are same and data is same.
My question is:
Which map will takes more memory and working faster m1 or m2? And how much?

In fact my question is:
What work faster and take less memory array or class and if we have huge amount of instances? And how much?

Thank you.
Reply
#2
Very unclear question.
Isn't this question sort of like:
Which runs faster a red ant or a green beetle
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  go over and search in numpy array faster caro 7 1,737 Jun-20-2022, 04:54 PM
Last Post: deanhystad
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,696 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  How do I get memory consumed by each item in the array? Bhavika 2 2,100 May-24-2020, 06:09 PM
Last Post: Bhavika
  Memory Use in array fakka 11 4,469 Jan-29-2020, 04:21 PM
Last Post: fakka
  class random var write to array storzo 5 2,876 Aug-02-2019, 03:26 PM
Last Post: storzo
  Multi-Dimm Array or Class? PappaBear 2 2,254 May-02-2019, 07:04 PM
Last Post: PappaBear
  To make an algorithm work faster pianistseb 3 2,790 Apr-01-2019, 08:42 AM
Last Post: Gribouillis
  Best construct? Array, class, other? PappaBear 1 2,965 May-10-2017, 06:02 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020