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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:30:58+00:00 2026-06-05T02:30:58+00:00

I want to compress much small strings (about 75-100 length c# string). At the

  • 0

I want to compress much small strings (about 75-100 length c# string).
At the time the dictionary is created I already know all short strings (nearly a trillion). There will no additional short strings in future.
I need to extra exactly one string without decompress other strings.

Now I am looking for a library or the best way to do the following:

  1. Create a dictionary using all strings I have
  2. Using this dictionary to compress each string
  3. a way to compress one string using the dictionary from 1.

I found a good related question, but this is not c# specific. Maybe there is something for c# I do not know, or a fancy library or someone has already done that. That is the reason I ask this question.

EDIT:

With dictionary I am talking about things like this: http://en.wikipedia.org/wiki/Dictionary_coder
But everything helps to get the strings shorter. The strings are short text messages in various languages and URLs (30%/70%). There is no need that the compressed strings is human readable. It will be stored in binary files.

  • 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-06-05T02:31:00+00:00Added an answer on June 5, 2026 at 2:31 am

    If there are a trillion strings and no more, then each can be represented in 40 bits (5 bytes). All you need is a way to use the 5-bytes as an index to the trillion strings.

    How do you know all trillion strings? If the compressor and decompressor both have access to all trillion strings, or if there is way to order and recreate the strings, then all you need is the index.

    If you can’t find a way to index the strings, then you can take a subset of the strings and use them as a dictionary for a compressor. Just take the most representative sample (you need to figure out what might make some of the strings more common than the other strings or more representative of the other strings) and concatenate them into a 32K dictionary. About 400 of your trillion strings. Then zlib’s deflateSetDictionary on the compress end and inflateSetDictionary on the decompress end, both using exactly the same 32K dictionary. That will provide good compression on the short strings.

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

Sidebar

Related Questions

want to know why String behaves like value type while using ==. String s1
I want to compress/transform a string as new string. i.e.: input string: USERNAME/REGISTERID output
I want to compress big text files with python (I am talking about >20Gb
I want to compress a directory in Linux. I created a tar.gz that it
I'm looking for JavaScript implementation of string inflating algorithms. I want to compress on
I want to make my own text file compression program. I don't know much
I want to compress all my js and css files for a project and
I have an Umbraco 4.7.x project (.NET 4.0 webforms) where I want to compress
I want to use YUI Compressor to combine and compress my css and js
I have a list of n strings (names of people) that I want 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.