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 6896373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:01:54+00:00 2026-05-27T07:01:54+00:00

I have an Object which stores pairs for a find and replace that I

  • 0

I have an Object which stores pairs for a find and replace that I perform on up to 1500 Strings at a time.

The Object is populated with pairs using a method that will accept a String and then store this as a property with the value being an automatically assigned base 36 number, like this:

function addShort(long:String):void
{
    _pairs[long] = _nextShort;
}

_nextShort returns an automatically incremented value being the subject of .toString(36), so running the above a few times might make _pairs look like this:

_pairs:Object = {
    "class": "0",
    "testing.objects.TestBlock": "1",
    "skin.x": "2",
    "skin.y": "3",
    ...........
    "someString": "az1"
};

This Object could realistically end up being really large, having over a couple hundred pairs stored.

I then have a method that will take a “long” String (which will include the Strings I’ve given to addShort() previously) and return a new String where these have been replaced with their respective short value.

The method looks like this:

public function shorten(long:String):String
{
    for(var i:String in _pairs)
        long = long.split(i).join(_pairs[i]);

    return long;
}

Nice an simple, however in my mind I foresee a massive problem in a case where I might want to “shorten” 2000+ Strings and the _pairs Object has at the same time has over 500 pairs.

That ends up being 1,000,000 iterations all up which obviously doesn’t seem very efficient at all.

How can I improve this process significantly?

  • 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-27T07:01:55+00:00Added an answer on May 27, 2026 at 7:01 am

    Based on comments from @kapep I realized what I needed is actually a compression library that will do this work for me.

    I stumbled across an LZW compression class within a package called Calista which works great.

    I did notice that the compression was really slow, which is understandable, but if there are any suggestions for something quicker I’m open to them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object which has several properties that are set when the object
I have an object which stores a latitude/longitude/altitude, and need reliable and fast -hash
Ok I have a reservation object which stores all details of event for which
I have a map that stores pointers to an object by their ID. typedef
I have a model that looks like this and stores data as key-value pairs.
I have designed a class which is basically nothing but an object which stores
I have a program in which I need to store a Class object into
I have object A which in turn has a property of type Object B
I have object A which contains multiple instances of object B, which in turn
I have an object which straight forward instance variables. Some are NSString, some are

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.