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

Re^4: XML::Twig and threads

by grizzley (Chaplain)
on Nov 28, 2012 at 09:57 UTC ( #1005996=note: print w/ replies, xml ) Need Help??


in reply to Re^3: XML::Twig and threads
in thread XML::Twig and threads [solved]

I won't bet obviousness :)

I've updated question node with example XML and script doing the job. Input file is read again in each of few hundred iterations. I was thinking about reading it once and then make in-memory copy in each iteration, but this will include swap on HDD and definitely won't speed up the code. Another way would be to store all changes write altered version to file, undo stored changes etc. That would save copying, but on the other hand as there are many changes - structure storing changes might be of same size as original. The best would be to somehow write to file original structure line after line and replace fragments on-fly.


Comment on Re^4: XML::Twig and threads
Re^5: XML::Twig and threads
by BrowserUk (Pope) on Nov 28, 2012 at 13:44 UTC

    Firstly, updating the root node with new code is a bad idea. Very few if any people will re-read old nodes, so it will never be seen except by those you notify.

    Second, posting code that doesn't use strict & warnings and contains trivial errors that those would catch:

    Use of uninitialized value $fields[2] in pattern match (m//) at C:\tes +t\1005623.pl line 56. Use of uninitialized value $fields[3] in pattern match (m//) at C:\tes +t\1005623.pl line 64.

    will stop most people (including me) from looking further.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

      Ok, noted. I just didn't want to start new discussion on the same topic.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-11-01 01:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (227 votes), past polls