[QUOTE=likesoursugar;31830045][cpp]m_mapData.m_data = new unsigned char[MAP_SIZE_FULL];[/cpp][/QUOTE]
is map size full, the 3 dimensions of the map?
[QUOTE=thf;31830010]Then calculate it like 100 times and benchmark that instead :v:[/QUOTE]
I don't have linux but sure, try it out.
[csharp]using System;
using System.Diagnostics;
namespace Benchmark
{
class Program
{
static int Fibonacci(int n)
{
int a = 1;
int b = 0;
for (int i = 0; i < n; ++i)
{
int c = b;
b = a;
a += c;
}
return a;
}
static void Main(string[] args)
{
var timer = Stopwatch.StartNew();
for (int i = 0; i < 100; ++i)
{
Console.WriteLine(Fibonacci(100000));
}
timer.Stop();
Console.WriteLine(timer.ElapsedTicks / (float)Stopwatch.Frequency * 1000);
Console.ReadKey();
}
}
}
[/csharp]
It's 100 ms when I try it. Even faster than before.
[QUOTE=Richy19;31830066]is map size full, the 3 dimensions of the map?[/QUOTE]No it's all 4 dimensions.
[QUOTE=Richy19;31830066]is map size full, the 3 dimensions of the map?[/QUOTE]
yep, x * y * z, so in this case 10 * 10 * 10.
[QUOTE=likesoursugar;31830108]yep, x * y * z, so in this case 10 * 10 * 10.[/QUOTE]
Nice, I seem to remember when storing 2d maps in a 1d array you accessed them by [b]y + x * width[/b]
How do you do it with a 3d array?
[QUOTE=Richy19;31830193]Nice, I seem to remember when storing 2d maps in a 1d array you accessed them by [b]y + x * width[/b]
How do you do it with a 3d array?[/QUOTE]
x + y * width + z * width * height
[QUOTE=Richy19;31830193]Nice, I seem to remember when storing 2d maps in a 1d array you accessed them by [b]y + x * width[/b]
How do you do it with a 3d array?[/QUOTE]
hehe yeah. Took me some time to figue it out but:
[cpp]
int VecToNum3(Vector3f vector, Vector2i size)
{
return int( ( ((int)vector.x + ((int)vector.y * size.x)) + ((int)vector.z * size.x * size.y)) );
}
[/cpp]
Should use a Vector3i class for this tho.
ninjad
[QUOTE=Chris220;31830255]x + y * width + z * width * height[/QUOTE]
Is it generally better to use normal arrays instead of 2/3d?
[QUOTE=Zyx;31830612]Is it generally better to use normal arrays instead of 2/3d?[/QUOTE]
Depends on the language, in C# for example it doesnt make that much of a difference.
But in C++ its harder to use multidimensional arrays unless you know the exact size of it
[QUOTE=Zyx;31830612]Is it generally better to use normal arrays instead of 2/3d?[/QUOTE]
Cleaner in the memory, easier to point
Has anyone got a nice article on Matrices that won't bore me to death with the maths.
I know what they are enough to use them and guess, but it'd be nice to understand them better.
[QUOTE=Darwin226;31830073]I don't have linux but sure, try it out.
[csharp]using System;
using System.Diagnostics;
namespace Benchmark
{
class Program
{
static int Fibonacci(int n)
{
int a = 1;
int b = 0;
for (int i = 0; i < n; ++i)
{
int c = b;
b = a;
a += c;
}
return a;
}
static void Main(string[] args)
{
var timer = Stopwatch.StartNew();
for (int i = 0; i < 100; ++i)
{
Console.WriteLine(Fibonacci(100000));
}
timer.Stop();
Console.WriteLine(timer.ElapsedTicks / (float)Stopwatch.Frequency * 1000);
Console.ReadKey();
}
}
}
[/csharp]
It's 100 ms when I try it. Even faster than before.[/QUOTE]
You should remove the Console.WriteLine. It adds a lot of time to it.
[QUOTE=CarlBooth;31830711]Has anyone got a nice article on Matrices that won't bore me to death with the maths.
I know what they are enough to use them and guess, but it'd be nice to understand them better.[/QUOTE]
This one helped me much as hell to understand! The axis example is neat :
[url]http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html[/url]
[QUOTE=high;31830719]You should remove the Console.WriteLine. It adds a lot of time to it.[/QUOTE]
I thought about that but I think it's fair to benchmark the output speed as well.
[QUOTE=Darwin226;31831081]I thought about that but I think it's fair to benchmark the output speed as well.[/QUOTE]
But that's not what you're benchmarking though?
[QUOTE=Nighley;31828709]I used integer, which means it will overflow pretty fast and will never reach the real result, as this is simply benchmarking the result is actually not important ;p
and for real benchmarking we should use more complex algorithms, this isn't really a good benchmark algorithm as all it's measuring is value assignment and simple ALU operations.[/QUOTE]
Just out of curiosity, I put in a 'flag' and found out it does a rollover 24948 times before it finishes.
[QUOTE=Darwin226;31831081]I thought about that but I think it's fair to benchmark the output speed as well.[/QUOTE]not really? You're bench marking the language's speed, the output can be delayed by all sorts of shit.
[QUOTE=Darwin226;31829972]No one makes a program for the sole purpose of calculating the nth number of the fibonacci sequence.
If we are talking about real world applications, JIT is insignificant.[/QUOTE]
Maybe not printing the fibonacci sequence, but altering/searching text (sed, grep), converting images (imagemagick), querying system information (free, ipconfig/ifconfig, netstat, lspci, etc.), doing HTTP transactions (curl, wget), etc.
JIT is insignificant for [i]some[/i] things. An ideal benchmark would have results for both small data sets (where JIT compilation has a significant impact) and large data sets (where it is insignificant)
[IMG]http://filesmelt.com/dl/screenshot-1.png[/IMG]
YES YES YES YES!
[editline]19th August 2011[/editline]
Basics, Check, Floors, Still wip.
[img]http://i.imgur.com/JN2c0.jpg[/img]
Fully procedurally generated voxel based cave system, complete with a GPU-side procedurally generated rock texture.
I'm going to be doing the Ludum Dare Jam, I'll post progress here :)
Java--
[quote]
seconds: 0.01336762
679394397
[/quote]
(about 13ms)
It could be reduced if i didn't convert nanos to seconds and print it there, but w/e
I was meant to be doing something productive, but I discovered the winsound.beep function in Python and spent 20 minutes annoying my cat. :/
You guys do know it's a stupid idea to try and compare these times because we all have systems that perform differently, right?
[QUOTE=thelinx;31832731]You guys do know it's a stupid idea to try and compare these times because we all have systems that perform differently, right?[/QUOTE]
Yep. One person should run all of the benchmarks on the same system.
[QUOTE=Niteshifter;31831371]Just out of curiosity, I put in a 'flag' and found out it does a rollover 24948 times before it finishes.[/QUOTE]
I found out I was wrong (dumb mistake). If there wasn't a rollover for the "held" value, the rollover count would have around 20000 digits to it.
A dungeon game I've been working on since last Saturday or so:
[media]http://www.youtube.com/watch?v=HR0RDSmNGAo[/media]
[QUOTE=BlkDucky;31832859]Yep. One person should run all of the benchmarks on the same system.[/QUOTE]
Im happy to do it as long as people can write the languages that I dont know
More to the point, we need a test that will put the language to the test more
Working on:
A game in SFML called Pong: Evolved where you have to play pong but at the same time try to kill the opponent and it has a Gun-Game-ish thing where when you kill him you go to the next gun until you get to the last gun.
No pics because I'm getting an annoying error that I can't find a fix for and I am currently working on a crappy computer.
Suddenly, Gabe N.
[IMG]http://localhostr.com/files/blD8vph/gaben.png[/IMG]
Sorry, you need to Log In to post a reply to this thread.