Go to file
Florent Rougon 1310092c0c SGPath: enable move operations
This is done by simply not user-defining the copy constructor,
copy-assignment operator and destructor. See [1] for more info.

[1] http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf

For the benchmark below (compiled with the next commit to allow sorting
SGPath instances), on Linux amd64 with g++ 6.3.0, I observe that
enabling SGPath move operations with this commit increases the
performance by 31% or 28% respectively, depending on whether I use this:

  // Typical code that creates a data structure in several steps and
  // benefits from move operations (the std::move() does nothing when
  // running the test with move operations disabled: a copy is made).
  auto p = SGPath::fromUtf8(randomString(0, 30));
  v.emplace_back(std::move(p));

or that:

  v.emplace_back(randomString(0, 30))

for the initialization code. Now the benchmark code:

using std::string;

static std::default_random_engine randomNumbersGenerator;

// Utility function: generate a random string whose length is in the
// [minLen, maxLen] range.
string randomString(string::size_type minLen, string::size_type maxLen)
{
  std::uniform_int_distribution<string::size_type> sLenDist(minLen, maxLen);
  std::uniform_int_distribution<int> byteDist(0, 255);
  auto randomByte = std::bind(byteDist, randomNumbersGenerator);

  string::size_type len = sLenDist(randomNumbersGenerator);
  string str;

  while (str.size() < len) {
    str += std::char_traits<char>::to_char_type(randomByte());
  }

  return str;
}

// The test function, run with nbIterations = 500000, minSize = 0 and
// maxSize = 200 to obtain the figures given above.
void SGPath_perfTest(std::size_t nbIterations,
                     std::size_t minSize, std::size_t maxSize)
{
  std::uniform_int_distribution<std::size_t> sizeDist(minSize, maxSize);
  auto randomSize = std::bind(sizeDist, randomNumbersGenerator);

  std::chrono::time_point<std::chrono::system_clock> start, end;
  start = std::chrono::system_clock::now();

  vector<SGPath> v;

  for (std::size_t i=0; i < nbIterations; i++) {
    v = vector<SGPath>{};          // start anew

    for (std::size_t j=0; j < randomSize(); j++) {
      v.emplace_back(randomString(0, 30));
    }

    std::shuffle(v.begin(), v.end(), randomNumbersGenerator);
    std::sort(v.begin(), v.end());
  }

  end = std::chrono::system_clock::now();
  std::chrono::duration<double> elapsedSecs = end - start;
  std::cout << elapsedSecs.count() << "\n"; // duration in seconds
}
2017-11-18 14:54:33 +01:00
3rdparty Fix VS2015 compilation 2016-05-31 13:40:32 +01:00
CMakeModules Update to the (now GPL) AeonWave version 3.0+ 2017-10-31 10:42:44 +01:00
package Remove plib reference 2012-08-28 13:04:25 +02:00
simgear SGPath: enable move operations 2017-11-18 14:54:33 +01:00
.gitignore Remove temporary file and add to .gitignore 2013-09-07 14:28:46 +02:00
AUTHORS Added Curt to empty Authors file as CVS test. 2001-12-11 22:23:25 +00:00
ChangeLog Let the version number reflect the current state of the release process. 2010-01-21 06:15:18 +01:00
CMakeLists.txt Fix CMake test for std::isnan() 2017-10-23 19:29:07 +02:00
COPYING Fix rpmlint/Linux packager complaints 2012-05-05 00:30:16 +02:00
Doxyfile Lots of (mostly) doxygen fixes/cleanup. 2014-08-01 00:13:25 +02:00
DoxygenMain.cxx - Tweaks to doxygen main page. 2003-06-11 18:55:36 +00:00
INSTALL Remove plib dep references from documentation files 2012-08-29 12:08:27 +02:00
NEWS Attempt to sort out the version number mess in preparation for a 1.9.0 release. 2008-12-19 20:39:59 +00:00
README Update README/INSTALL documentation. 2012-06-26 22:43:48 +02:00
README.cmake Remove plib dep references from documentation files 2012-08-29 12:08:27 +02:00
README.OpenAL Remove a couple of lingering alut references. 2012-08-21 19:25:33 +01:00
README.OSG Update README/INSTALL documentation. 2012-06-26 22:43:48 +02:00
README.zlib Updates to remove unneeded and old version of zlib source. 2006-03-23 21:59:59 +00:00
SimGearConfig.cmake.in Update to the (now GPL) AeonWave version 3.0+ 2017-10-31 10:42:44 +01:00
Thanks SimGear: Typo in Thanks file 2007-07-23 22:00:31 +00:00
version new version: 2017.4.0 2017-09-17 12:14:00 +02:00

SimGear - Simulator Construction Tools
======================================
http://www.flightgear.org

SimGear is a set of open-source libraries designed to be used as building
blocks for quickly assembling 3d simulations, games, and visualization
applications.

SimGear is developed by the FlightGear project and also provides the base
for the FlightGear Flight Simulator.

Source code for SimGear is released under the GNU Library General Public
License (LGPL) - see COPYING for license details.

See INSTALL file for help on building SimGear.