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

  • SEARCH
  • Home
  • 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

Accept is not listed in the forbidden headers in the documentation here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLRequestHeader.html but
I've seen it used a couple places: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ http://developer.yahoo.com/flash/astra-flash/classreference/ Is this just a coincidence
REF: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html With regards to a parent SWF loading a child SWF via the
In AS3, what is ApplicationDomain.domainMemory for? http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/system/ApplicationDomain.html#domainMemory
I went through a document at Adobe Livedocs that describes working with pdf: http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html
I find out how to replace the busy cursor here: http://livedocs.adobe.com/flex/3/html/cursormgr_3.html However, how do
Hello StackOverflow community, The air.swf file referenced here: http://livedocs.adobe.com/flex/3/html/help.html?content=distributing_apps_3.html used to launch AIR applications
I read through the method to connect to a socket server : http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_5.html I
Based on this Adobe multiple axis chart example: http://livedocs.adobe.com/flex/3/html/help.html?content=charts_types_12.html Then I changed some data
http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid

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.