Jul 25, 2008

Optimization Tale Plus Question

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Perl Programming

free web hosting

Optimization Tale Plus Question

kvarnerexpress
Just figured I'd post this real quick as I found the experience fairly amusing.

I was working on some code last week that, when I applied it to the full set of data, took about 1 hour and 10 minutes to run. Needless to say, this is quite slow, however I was using unoptimized code. I went for correctness first. Anyway, the first thing I noticed was that I could eliminate a good deal of array copying. I fixed that and it cut the time down to 23 minutes. This is still a lot slower than I wanted, so I went back to trying to optimize the code. After trying various things and researching some different things to optimize in Perl, I tried something completely and utterly stupid: I changed push to unshift. Now, I could do this since I was sorting the array later anyway, so ordering did not matter at this point.

Did it work? The code ran in 34 seconds. I must say, I was quite shocked by this. This leads me to my question: what's the difference between push and unshift in terms of how they work? I know they put data on different sides of the array. I'm just wondering why that made such a profound performance difference.

 

 

 


Reply

kvkv
That is a bit shocking because internally perl manages arrays as lists. And push() and unshift() are almost the same when it comes to performance. Are you sure you are dealing with the same set of data and haven't changed anything else? Can you post a code snippet that I can look into?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : optimization, tale

  1. Website Optimization Help
    (0)
  2. Google Optimization For Drupal
    (0)
    If I search my own site in google, the first page isn't my home page, but a profile of one of my
    members in Drupal. My homepage is just 2 results under it. I think that's very enoying. Does
    anyone know how to change that? I really love Drupal. So I don't want to change it for any other
    content management system. Thanks....
  3. Css Resolution Optimization
    (6)
    Hey, I've got a CSS sheet that was for some reason optimized for 1171x721. How can I scale that
    down to 1024x768? Or make it so it has no optimization and is just scrollable? Thanks /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Harrison....
  4. Search Engine Optimization Tools
    (11)
    Hi All, I'm looking for some tools or any tricks for the SEO.. I have studied many things
    online about google search rank, page rank .. and all but all goes from above my head /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> can anyone tell me in simple
    way how I can bring my site in at least top 20-30 in google if not in top 10 thanks dedesigns
    Edit typo ....
  5. Free Seo
    search engine optimization (2)
    where could you find free SEO? i simple don't know any company to offer that kind of service...
    there is just gxm sollutions who does offer this service... the page is http://www.graphixmix.go.ro
    ....
  6. Free E-gold Games Scripts
    Free e-gold games: head or tale game, batch game....Where can I get th (1)
    Hello. I am going to open my own e-gold games site, so I need e-gold games scripts. Does someone
    know from where I can get them? THX.....
  7. Image Optimization?
    Anybody have some info or tutorials on Image Optimization? (6)
    Hi, Im am to present the subject: Image Optimization in class this saturday, Ive have already
    started searching and Investigating all the info I can get from google and places like P2L, but If
    you happen to know something about the subject, or know some really good tutorials about it please
    reply. Thanks in advance. /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" />....
  8. All You Need For Seo (search Engine Optimization)
    Article and Resources list (2)
    QUOTE SEO is an acronym for "search engine optimization". It is the process of analyzing
    your potential design and problems for search engines indexing and positioning. In other words,
    making your web site and its content attractive, relevant and visible to search engines and web
    searchers. There is nothing worse than having a beautiful web site with excellent written content,
    though you still lose traffic or you even keep potential visitors away, while your site cannot be
    found. Before you begin optimizing your pages for Search Engines, consider that the fol....
  9. Web War
    a tale of two websites (8)
    well, it's a "unique" ongoing web war... so i'm posting it here to solicit your thoughts.
    /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' /> once upon a time, there
    were two websites: itchysquirrel and lastofthedotcoms. the latter admired the former and considered
    it a "funny" site, so it asked the former for a link exchange. yup, "add our site link on your site,
    we add yours" kind of deal. /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif'
    /> it went well for a while, until it was later discovered by the latter t....
  10. Good Way To Get Ranked In Google
    SEO services, search engine optimization (30)
    I heard the best way search engines find you even google is u have to have alot of links on your
    site. The more pages and links on your site, the bigger chance search engines will find you and the
    more you'll be seen on them as well. I would give you some pages i read this off of, but it was
    a while ago, so why don't you search it in Google!? I hear that search engines don't
    really use keywords in meta tags anymore, but if you have alot of pages with alot of stuff, you can
    win. ADVERT : SEO services, search engine optimization service by SerpGuru .....
  11. Secrets To Getting To The Top Of Google
    Search Engine Optimization Tips for Google (45)
    Here, you will give advice (tutorials) on how to get to the top of Google.....
  12. Help With A Css Design
    code optimization (8)
    hello there!, i need somebody tell me how to put a scrollbar into my divs or tables, and how to
    delete the h3 cellpadding or how to bold a text with css. thanks a lot! /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> ....
  13. How To Perform Search Engine Optimization
    How to increase your page rank in the search engines (8)
    Below are some steps which all web designers should take to improve the listing of their sites in
    the major search engines. STEP 1: Related titles!!!!! It is very important
    when choosing a title and URL for your site that you use something that is relevant. For example,
    if you are selling alarm clocks you would want a name that is related that people may type in as a
    search word. STEP 2: Keywords, Keywords, Keywords!!!!!! and I'm not
    talking about Meta Tags! I'm talking about keywords in your description. You....
  14. Adsense Optimization
    (4)
    Google will say the best for you /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> https://www.google.com/support/adsense/bin/...?page=tips.html You
    don't have to put URLs in code boxes because it's not code, and others can't click on
    it. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
  15. Google Search Engine Optimization
    Utilizing META tags (3)
    Not sure if anyone knows about this or not, but there's actually a really cheap, easy way to
    advertise, and it kinda works with the banner exchange idea. It has to do with META tags in the
    header section of your html. Here's an example from one of my sites: CODE <META
    name="description" content="Christy is a Tampa Strip Club Dancer"> <META
    NAME="keywords" content="Tampa, Strip Club, Strip Club, Dancer, Tampa Strip Club
    Dancer"> <META NAME="TITLE" CONTENT="Tampa Dancer"> <META NAME=....
  16. Html Advertising Optimization
    (0)
    Not sure if anyone knows about this or not, but there's actually a really cheap, easy way to
    advertise, and it kinda works with the banner exchange idea. It has to do with META tags in the
    header section of your html. Here's an example from one of my sites: CODE <META
    name="description" content="Christy is a Tampa Strip Club Dancer"> <META
    NAME="keywords" content="Tampa, Strip Club, Strip Club, Dancer, Tampa Strip Club
    Dancer"> <META NAME="TITLE" CONTENT="Tampa Dancer"> <META NAME=....
  17. Shark Tale ?
    Woopee (9)
    Hey hey hey anyone seen it ??? It is REALLY REALLY REALLY good......ist it ?? YES........ It's
    excellent..................................................................working at the car wash
    ...YEAH....
  18. Optimization Software
    what software you are using? (28)
    hello all! i am new here and interested in website optimization i seen several websites using
    doorways? anybody here using it? and what software you use to make it?....

    1. Looking for optimization, tale

Searching Video's for optimization, tale
advertisement



Optimization Tale Plus Question



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE