Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

New features of U++ Core 2016

Allocator

U++ allocator now always returns 16-byte aligned blocks. This is to simplify SSE requirements, at the price of smallest possible allocation being 32-bytes (request for smaller blocks are rounded up to 32-bytes).

In situation where allocating a lot of blocks smaller than 32 bytes (typical is controlling reference counter block in shared_ptr like class), new TinyAlloc / TinyFree functions can be used, or templated "new/delete" like functions tiny_new / tiny_delete.

Multithreading

One of biggest advances of C++11 is support for multithreading memory model. That is why we could drop U++ memory model support and use what language/standard library provides - Atomic is now reimplemented using std::atomic<int>, thread local variables are language standard. OTOH, beyond memory model, U++ Thread class and CoWork class are still basis of multithreading.

ConditionVariable is now recommended over Semaphore. We keep U++ class for this one, because in Win32 ConditionVariable requires Windows 7 and we still want to keep WinXP support (U++ ConditionVariable contains internal implementation when system API is missing).

Thread::Exit can be used to exit the thread (from within), similar to Exit to exit the whole program. It throws exception, which is caught at the end of thread routine.

CoWork was optimized and also changed so that each "master thread" has private thread pool. This is important to avoid stealing of work between master threads, which can lead to problems (e.g. delays in the GUI).

CoWork::FinLock now provides 'finalization lock', useful to avoid additional mutex lock for e.g. storing results.

CoWork now also has pipeline support, where thread performs one specific task and eventually passes results to another thread to continue processing.

Callback changes

Callbacks are refactored with C++11 lambdas and varargs templates. There are now 3 classes:

Function is similar to std::function, generic callable with any number of parameters and any return value in addition it has ability to 'add' functions using operator<<. Also, unlike std::function, calling empty Function is no operation, not exception.

Event is equivalent of Callback - unlike Callback, it is not necessary to have Callback, Callback1, Callback2, number of parameters is resolved by C++11 template varargs.

Callback is deprecated but supported for backward compatibility.

Algorithms and Containers

The set of algorithms provided by U++ is now streamlined by introduction of Range concept. Range is entity that provides begin/end/GetCount/operator[] methods. All U++ algorithms expect Range as input. All U++ containers satisfy Range concept. In addition there are

SubRangeClass - represents subrange of container, or just begin/end pair.

ConstRangeClass - trivial single-value range

ViewRangeClass - is basically a list of indicies inside another range. FilterRange function can create ViewRangeClass based on predicate.

U++ containers now support InsertRange/AppendRange template methods.

New, parallel algorithms are introduced: CoLoop, CoAccumulate, CoSum, CoFindBest, CoFindMin, CoMin, CoFindMax, CoMax, CoFindMatch, CoFindIndex, CoSort, CoStableSort, CoIndexSort, CoStableIndexSort, CoIndexSort2, CoStableIndexSort2, CoIndexSort3, CoStableIndexSort3, CoGetSortOrder, CoGetStableSortOrder, CoSortByKey, CoSortByValue, CoStableSortByKey, CoStableSortByValue, CoSortIndex, CoStableSortIndex.

Tuple

Tuple now does not require the specific template type based on number of elements (instead of Tuple3<int, int, String> it can now be used just Tuple<int, int, String>). Tuple now has methods for retrieving the number of elements and index based access of elements via Value and also C++11 like access via template methods (index based or type based):

Tuple<int, String> x = MakeTuple(12, (const char *)"hello");

    

DUMP(x.a);

DUMP(x.b);

DUMP(x);

 

DUMP(x.GetCount());

DUMP(x.Get(0));

DUMP(x.Get(1));

DUMP(x.GetArray());

DUMP(x.Get<0>());

DUMP(x.Get<String>());

    

x.Set(1, "bar");

DUMP(x);

ValueArray va { 22, "world" };

x.SetArray(va);

DUMP(x);

Unfortunately, as 'Tuple' id now represents template class, 'Tuple' function had to be removed. Use MakeTuple instead.

Changes in r-value and pick

All features required for compatibility with C++99 (pick_ etc...) were removed in favor of using r-value references. "picked" state was removed, picking now simply clears the source to "empty" state. AddPick methods in containers are deprecated, use Add(pick(x)) instead. 'pick' is kept as synonym to std::move and clone is still required (containers do not provide default copy constructor).

Throughout library, "opportunity" r-value constructors/assignments are added. That has perhaps the most optimizing effect with chaining String operator+: String a; ... String x = a+ " foo " + "bar" does not perform any unnecessary copies now.

Smaller issues

Stream::SerializeRaw count is now int64 (instead of 32-bit int)

2GB items limit is better implemented in StringBuffer, WStringBuffer, StringStream.

StringStream now has SizeLimit option, if breached (when storing data to StringStream), exception is thrown.

NanoStrings class is removed.

HashFn / precomputed hash options in Index/Maps are removed.

Index/Maps are further optimized (about 5% gain in benchmarks).

 

Last edit by cxl on 12/12/2016. Do you want to contribute?. T++