Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

judy

Name: Anonymous 2011-06-26 21:46

does /prog/ know this lib? http://judy.sourceforge.net/error/index.html
I need something faster!

Name: Anonymous 2011-06-26 21:51

try Lua tables.

Name: Anonymous 2011-06-26 22:21

>>1
Judy is just a more advanced version of the Standard C Library assert macro.

You should only use assert to ensure program invariants in debug or internal/testing builds, and then conditionally disable them for your final production test and release builds once your software has been thoroughly tested--thus making your final program faster and less bloasted.

Asserts are useful for tracking down programmer mistakes, and the likes.

They shouldn't be used for errors that are expected to occur during regular program execution.

Instead, you should just use return values to propagate expected errors up the call stack until a point where your program can make an actually useful decision on how to rectify the problem, ie. restart a certain process or subsystem, notify the user with a log message or GUI notification, etc.

In some object-oriented languages, exception handling is the preferred mechanism for error propagation.

But in C, you have no such luxuries. Some people try to use setjmp/longjmp, but that has poor guarantees on stack safety and cleanup, and slower than using asserts in your debug/test builds.

Name: Anonymous 2011-06-26 22:36

>>1
Oh, I see, you linked the wrong page, you were looking for an alternative sparse associative data structure.

Honestly, this is where I think C++ shines (granted that you test performance with optimizations enabled, debug performance will be slower due to of the nature of template class instantiation).

C++98/03 TR1's std::tr1::unordered_map (std::unordered_map in C++11/0x) is an associative hash table with chaining, which is suitable for sparse collections of heavy-weight objects.

If your objects are not heavy-weight, you can take a look at Google's dense_hash_map written in C++, which is suitable for dense collections of small objects. It's an associative hash-table that uses quadratic open-addressing.

They also have a sparse_hash_map, but it's essentially just an alternative to std::unordered_map.

http://code.google.com/p/google-sparsehash/

Name: Anonymous 2011-06-27 5:40

>>1
Judy is well optimized; the parts that make it slow are all in your own code and design choices.

Don't change these.
Name: Email:
Entire Thread Thread List