473,394 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Big Hashtable or big Assembly Resource File?

Hi.

I would need an advice here please.

I have to define a set of constant key/value pairs for my C# .NET DLL
component.
We are talking about at least 5000 pairs
(where each key is a System.String and the corresponding value preferably is
a System.Byte [0x4] )

These pairs will only have to load at special occasions.

What would you think is the best approach, using a big static
System.Collections.Hashtable
loaded as needed, or using an Assembly Resource File loaded as needed?
Or perhaps there is another way? I can't think of any.

I am seeking the best way in a performance/efficiency point of view.

Thank you, Dennis
Nov 16 '05 #1
2 2421
"Dennis Myrén" <de****@oslokb.no> wrote in
news:MN******************@news2.e.nsc.no:
I have to define a set of constant key/value pairs for my C# .NET DLL
component.
We are talking about at least 5000 pairs
(where each key is a System.String and the corresponding value
preferably is a System.Byte [0x4] )

These pairs will only have to load at special occasions.

What would you think is the best approach, using a big static
System.Collections.Hashtable
loaded as needed, or using an Assembly Resource File loaded as needed?
Or perhaps there is another way? I can't think of any.

I am seeking the best way in a performance/efficiency point of view.


A hashtable is definitely the fastest. It doesn't matter in memory
usage that much, as with both you have to construct the complete datastore
for a single entry. The hashtable takes some time to setup, especially
with a lot of entries (so set the initial size correctly!), where a
resource file is loaded immediately (or is even compiled into the
assembly). However once the hashtable is setup, stringsearches are very
fast, much faster than the linear search in a resource.

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
Thank you!
"Frans Bouma [C# MVP]" <pe******************@xs4all.nl> wrote in message
news:Xn*********************************@207.46.24 8.16...
"Dennis Myrén" <de****@oslokb.no> wrote in
news:MN******************@news2.e.nsc.no:
I have to define a set of constant key/value pairs for my C# .NET DLL
component.
We are talking about at least 5000 pairs
(where each key is a System.String and the corresponding value
preferably is a System.Byte [0x4] )

These pairs will only have to load at special occasions.

What would you think is the best approach, using a big static
System.Collections.Hashtable
loaded as needed, or using an Assembly Resource File loaded as needed?
Or perhaps there is another way? I can't think of any.

I am seeking the best way in a performance/efficiency point of view.


A hashtable is definitely the fastest. It doesn't matter in memory
usage that much, as with both you have to construct the complete datastore
for a single entry. The hashtable takes some time to setup, especially
with a lot of entries (so set the initial size correctly!), where a
resource file is loaded immediately (or is even compiled into the
assembly). However once the hashtable is setup, stringsearches are very
fast, much faster than the linear search in a resource.

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ricardo Pereira | last post by:
Hi, I wrote a simple program to test the "out-of-the-box" functionalities of the CMAB (Configuration Management Application Block). After having added 2 values to an hashtable, and having written...
1
by: Cindy | last post by:
I'm trying to create a satellite assembly for my winform project but the resource.dll that gets created with the assembly linker (al.exe) doesn't get used when the language is specified. However,...
0
by: Namratha Shah \(Nasha\) | last post by:
Hi All, Assembly linker is a tool which is used to create an assembly by combining one or more .netmodules and resource files. In simple words an .netmodule is an IL file that does not have ...
0
by: mnmnm1951 | last post by:
I am working with Sharepoint Services and am trying to add the fileversion Metadata to the Versions.aspx page using the example from the SDK. I have not done much with hashtables but it all looks...
3
by: Kelmen Wong | last post by:
I'm having a real hard-time to work out the hell of the statelite assembly. 1) At start, the official MSDN stated to use: .... new ResourceManager(strBaseName,...
0
by: Kevin Frey | last post by:
I am relatively new to ASP.NET development. We have built an assembly in C++ (mixed mode) that will be used by our ASP.NET application. The assembly can also be used outside of ASP.NEt. ...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
0
by: =?Utf-8?B?Q29saXZpZXI=?= | last post by:
If anyone can help me with this I would really appreciate it: I have an assembly into which I have linked a manifest file as a Win32 resource. This is necessary since I want to use a class in this...
4
by: Bob Altman | last post by:
Hi all, I have a C++/CLI project (VS 2005) that produces a DLL that exports C bindings. Internally, this DLL contains routines compiled with /clr. I notice that my DLL doesn't have a version...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.