Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:10:46+00:00 2026-05-13T21:10:46+00:00

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ The dictionary does what I need but I do need to care about

  • 0

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

The dictionary does what I need but I do need to care about performance. Does anybody know if the Dictionary is implemented as a hashtable?

Or more specifically, does it perform in O(1)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:10:46+00:00Added an answer on May 13, 2026 at 9:10 pm

    it acts as a hashmap. in fact, every ActionScript object that is an instance of a dynamic class, acts as hashmap. of course keys can always collide with properties. this behaviour comes from JavaScript. I consider it a design failure.

    Array is different in that it will perform some tricks on integer keys, and Dictionary is different in that it doesn’t convert keys to strings, but uses any object value as key. Please note that Number and Boolean are both converted to String.

    now why whould you care how it is implemented? if it is well implemented, you probably don’t wanna know. You can benchmark it. It has O(1) for all operations and is reasonably fast (inserting costs a about twice as much time as an empty method call, deleting costs less). Any alternative implementation will be slower.

    here a simple benchmark (be sure to compile it for release and run it in the right player):

    package  {
        import flash.display.Sprite;
        import flash.text.TextField;
        import flash.utils.*;
        public class Benchmark extends Sprite {
    
            public function Benchmark() {
                var txt:TextField = new TextField();
                this.addChild(txt);
                txt.text = "waiting ...";
                txt.width = 600;        
                const repeat:int = 20;
                const count:int = 100000;
                var d:Dictionary = new Dictionary();
                var j:int, i:int;
                var keys:Array = [];
                for (j = 0; j < repeat * count; j++) {
                    keys[j] = { k:j };
                }
                setTimeout(function ():void {
                    var idx:int = 0;
                    var out:Array = [];
                    for (j = 0; j < repeat; j++) {
                        var start:int = getTimer();
                        for (i = 0; i < count; i++) {
                            d[keys[idx++]] = i;
                        }
                        out.push(getTimer() - start);
                    }
                    txt.appendText("\n" + out);
                    start = getTimer();
                    for (var k:int = 0; k < i; k++) {
                        test();
                    }
                    txt.appendText("\ncall:"+(getTimer() - start));
                    idx = 0;
                    out = [];
                    for (j = 0; j < repeat; j++) {
                        start = getTimer();
                        i = 0;
                        for (i = 0; i < count; i++) {
                            delete d[keys[idx++]];
                        }               
                        out.push(getTimer() - start);
                    }
                    txt.appendText("\n" + out);
                },3000);//wait for player to warm up a little
            }
            private function test():void {}
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid
http://localhost/XYZ/Client/(S(enlodz55ov4ncafza0gpp045))/Info/Rates.aspx Does anyway know what /(S(enlodz55ov4ncafza0gpp045))/ means? Any help appreciated.
http://support.microsoft.com/kb/953102 We spent about 50 hours during Christmas holiday to identify this problem, causing
http://twitter.com/codinghorror http://twitter.com/login These both look like twitter accounts but the second one is not.
http://thedailywtf.com/Articles/The-Hot-Room.aspx You see how at the bottom there're links to the next and previous
http://developer.yahoo.com/javascript/howto-proxy.html Are there disadvantages to this technique? The advantage is obvious, that you can
http://www.codeplex.com/IIRF/Thread/List.aspx My webhost installed IIRF for me and I am convinced that they did
http://xurrency.com/api this webservice is returning a json response message. how can I use this
http://rndnext.blogspot.com/2009/02/jquery-ajax-tooltip.html I want to implement something like the link above. Now this pops up
http://www.google.fr/search?q=yacy+OPENSOURCE YaCy is free software (GPL-licensed) and open source. but I can't seem to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.