1
0

MCServer should be running fast again on Linux!! YAAAY!!

It seems the intialization of MersenneTwister was really slow on Linux because it did some file reading. Doing this 200 times a tick can be pretty slow...

StringUtils didn't compile in Cygwin due to missing va_list definition

git-svn-id: http://mc-server.googlecode.com/svn/trunk@230 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth 2012-02-03 16:01:25 +00:00
parent b8be8a4df0
commit c4abe1ed6a
2 changed files with 7 additions and 0 deletions

View File

@ -238,6 +238,8 @@ inline void MTRand::seed()
// Otherwise use a hash of time() and clock() values // Otherwise use a hash of time() and clock() values
// First try getting an array from /dev/urandom // First try getting an array from /dev/urandom
/* // Commented out by FakeTruth because doing this 200 times a tick is SUUUUPEERRR SLOW!!~~!ÕNe
FILE* urandom = fopen( "/dev/urandom", "rb" ); FILE* urandom = fopen( "/dev/urandom", "rb" );
if( urandom ) if( urandom )
{ {
@ -250,6 +252,7 @@ inline void MTRand::seed()
fclose(urandom); fclose(urandom);
if( success ) { seed( bigSeed, N ); return; } if( success ) { seed( bigSeed, N ); return; }
} }
*/
// Was not successful, so use time() and clock() instead // Was not successful, so use time() and clock() instead
seed( hash( time(NULL), clock() ) ); seed( hash( time(NULL), clock() ) );

View File

@ -11,6 +11,10 @@
#ifndef _WIN32
#include <stdarg.h>
#endif
typedef std::string AString; typedef std::string AString;