Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Reducing Memory Usage

by BrowserUk (Patriarch)
on Jul 16, 2004 at 08:09 UTC ( [id://374938]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Reducing Memory Usage
in thread Reducing Memory Usage

And how many (and what type) of objects does that translate to?


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^4: Reducing Memory Usage
by PerlingTheUK (Hermit) on Jul 16, 2004 at 08:22 UTC
    One object per line, some of which (average of 20 to 50 depending on the data) are subobjects of other objects. So I have like 50000 busses and about 33 objects with timetable information each.

      Ouch! It's not your data, but your objects that are killing you.

      I just loaded 2_000_000 objects ( hash-based, each containing 1 key - scalar 8 bytes. 1 value - string 80 bytes). I put the 2_000_000 object handles into a hash keyed by the id.

      Total data 2M * 80 = 152 MB.

      Total memory consumed 700MB.

      Add a few nested objects in each of those objects and you can see where your memory is going to.

      Imagine if perl stored unicode as objects, 1 character per, and strings were arrays of theose objects. A convenient OO-schema, but with today's hardware and today's memory limits, totally impractical.

      There has to be a better way.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://374938]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found