Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Reducing Memory Usage

by PerlingTheUK (Hermit)
on Jul 16, 2004 at 08:01 UTC ( [id://374936]=note: print w/replies, xml ) Need Help??


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

All lines are 80 chars, adding up to about 1,6 to 1.8 million lines.

Replies are listed 'Best First'.
Re^3: Reducing Memory Usage
by BrowserUk (Patriarch) on Jul 16, 2004 at 08:09 UTC

    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
      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://374936]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-19 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found