This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env = Environment() | |
linked_libs = ['Irrlicht', 'GL', 'freenect'] | |
cpp_flags = ['-std=c++0x'] | |
env.Append(LIBS = linked_libs) | |
if ARGUMENTS.get("debug",0): | |
cpp_flags += ['-g'] | |
env.Append(CPPFLAGS = ' '.join(cpp_flags)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.arch armv4t | |
.fpu softvfp | |
.eabi_attribute 20, 1 | |
.eabi_attribute 21, 1 | |
.eabi_attribute 23, 3 | |
.eabi_attribute 24, 1 | |
.eabi_attribute 25, 1 | |
.eabi_attribute 26, 2 | |
.eabi_attribute 30, 6 | |
.eabi_attribute 18, 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ CSC230 Spring 2012 -- Treadmill program | |
@ Author: Nicolas Guillemot | |
@ Student ID number: V00695164 | |
@ Global constants for physics | |
@ default value for weight | |
.equ DFT_WEIGHT, 100 @ lbs | |
@ minimum value for weight (see WeightMax for maximum) | |
.equ WEIGHT_MIN, 50 @ lbs | |
@ default value for target speed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <list> | |
#include <iostream> | |
#include <ctime> | |
// FIXME: v(1000000) creates a vector of 1000000 elements. At the end of the function there are 2000000 elements. Instead, it should be constructed empty and then v.reserve(1000000) should be called just after. | |
void createPreallocatedMillionVector() | |
{ | |
std::vector<int> v(1000000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vector took 0.18 seconds. | |
Preallocated Vector took 0.1 seconds. | |
Back pushed List took 1.38 seconds. | |
Front pushed List took 1 seconds. | |
Front pushed Pool allocated list took 0.67 seconds. | |
In other words, | |
Preallocating a vector makes it ~200% faster than not preallocating | |
Pushing to the front makes it ~150% faster than pushing to the back | |
Pushing to the front and using a pool allocator makes it ~200% faster than pushing to the back |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef HASHEDSTRING_HPP_INCLUDED | |
#define HASHEDSTRING_HPP_INCLUDED | |
#include <irrlicht/irrTypes.h> | |
// if HASHEDSTRING_USE_CONSTEXPR is defined, a recursive constexpr hashing algorithm will be used. | |
// otherwise, an iterative runtime hashing algorithm will be used. | |
#define HASHEDSTRING_USE_CONSTEXPR | |
// do not touch this block of preprocessor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
// if HASHEDSTRING_USE_CONSTEXPR is defined, a recursive constexpr hashing algorithm will be used. | |
// otherwise, an iterative runtime hashing algorithm will be used. | |
#define HASHEDSTRING_USE_CONSTEXPR | |
// do not touch this block of preprocessor. | |
#ifdef HASHEDSTRING_USE_CONSTEXPR | |
#define HASHEDSTRING_CONSTEXPR_IMPL constexpr | |
#else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ |
OlderNewer