• What are you working on? v19
    6,590 replies, posted
[QUOTE=reevezy67;31825703]Basically finished this game, though I will probably add a gamemode where you collect blocks instead of dodge them. [IMG]http://i.imgur.com/6ULv3.png[/IMG][/QUOTE] This is how you do programmer art. Nice, non-eye-burning colours.
Now try this one: [cpp] mov eax, 1; mov ebx, 0; mov edx, 0; __loop: mov ecx, ebx; mov ebx, eax; add eax, ecx; inc edx; cmp edx, 100000; jne __loop; [/cpp] I got 0.163ms :v:
[QUOTE=Neo Kabuto;31825199]I would like to see Java in addition.[/QUOTE] [IMG]http://www.binarybit.ch/imgs/bench.jpg[/IMG] n = 100000000 c++ vs Java c would be probably a bit faster and I'm sure you can optimize it even better, I used the same code for both, which probably favours java EDIT: [B]lol ok, using optimisation 0.013 ms for c[/B] with and without optimisation: [IMG]http://www.binarybit.ch/imgs/bench02.jpg[/IMG]
[QUOTE=Nighley;31825864][IMG]http://www.binarybit.ch/imgs/bench.jpg[/IMG] n = 100000000 c++ vs Java c would be probably a bit faster and I'm sure you can optimize it even better, I used the same code for both, which probably favours java EDIT: [B]lol ok, using optimisation 0.013 ms for c[/B] with and without optimisation: [IMG]http://www.binarybit.ch/imgs/bench02.jpg[/IMG][/QUOTE] Do you have optimization on the compiler? What compiler did you use? (For C++)
well yeah I forgot, but to be honest I never predicted more than 10 times increase in speed. interestingly when you display the result at the end the c++ executable takes 10 times longer than without the output (140ms) and in java not even twice longer (240ms) using gnu compiler
If you compile C++ in Debug mode, it's three times slower than LuaJIT. But if you don't, holy shit... :v:
[QUOTE=ZeekyHBomb;31821350]When you free memory, it doesn't immediately get destroyed. You just relinquish any responsibility over it, but the data itself might stay intact for a while. And it probably did, if you try to allocate more and more memory (or just more often) (-> more vertices), then the chance that this memory will be overwritten with something else is higher of course.[/QUOTE] The thing is, the Voronoi diagram generator doesn't run at any time between when that string is created and when it is used. All related code between the points where the string is generated and used stayed the same, so it wasn't the Voronoi diagram generator overwriting freed memory. I have a few guesses of why it happened...FreeImage was allocating memory between string creation and destruction. I probably pushed some larger memory allocations out of the same memory block, allowing smaller allocs to fit on that string alloc or something; I just don't know for sure exactly which memory allocations caused it or if my guess is even valid. The actual corruption was quite funny, too. We went from "textures/DefaultSkin.png" to "textures/DefaultSkin.png@" (both null-terminated). I actually remember copying the texture file to DefaultSkin.png@ and it worked flawlessly. Then, I deleted the texture and pulled my hair out about the Voronoi diagram generator. I seem to notice a trend of me looking directly at errors and not realizing they're errors. I guess I was thinking of the problem exactly the same as you and just dismissed it very casually, opting for magic invalid pointer theory (How did the Voronoi generator allocate over this string?). In hindsight, it is probably better to rank what we don't know as more important to what we do know in order to avoid this class of problem. [QUOTE=moonage;31821669]linux prefers UTF-8 (the superior encoding :v:)[/QUOTE] Indeed; my binding and key configurations systems "supported" UTF-8 from day one :v: As a "fun" side project, I considered writing a program to convert GWEN code to UTF-8, but it seems easier to just throw in a few conversion functions. I think Garry put all string-related stuff in a wrapper class, so it shouldn't be [i]too[/i] hard.
-snip-
[QUOTE=moonage;31825008]I tried a whole bunch of languages: C - 2ms Lua - 7ms C# - 25ms PHP - 27ms Perl - 39ms Node - 60ms Kari - 211ms Ruby - 304ms Python - 930ms Scheme - 1282ms[/QUOTE] What code did you use for C#?
[QUOTE=thomasfn;31824103][img]http://i.imgur.com/mIwpb.jpg[/img][/QUOTE] Rated artistic, you know why.
[QUOTE=Nighley;31825864][IMG]http://www.binarybit.ch/imgs/bench.jpg[/IMG] n = 100000000 c++ vs Java c would be probably a bit faster and I'm sure you can optimize it even better, I used the same code for both, which probably favours java EDIT: [B]lol ok, using optimisation 0.013 ms for c[/B] with and without optimisation: [IMG]http://www.binarybit.ch/imgs/bench02.jpg[/IMG][/QUOTE] How do you make it output the run time? dohh just noticed time [editline]19th August 2011[/editline] This is squirrel's [code] time ./sq a.nut real 0m0.009s user 0m0.007s sys 0m0.001s [/code] and the code: [code] function fib(n) { local a = 1 local b = 0 local i = 0 for(local i = 0; i < n; i++) { local c = b b = a a += c } return a } fib(100000) [/code] Its the right code right? This is the time if i print out the output [code] time ./sq a.nut 679394397 real 0m0.011s user 0m0.006s sys 0m0.003s [/code] the 679... is the result
particle system almost finished, just missing texture mode, acceleration (constant speeds as of yet) and rotation. BUT it has variable (and randomised if wanted) speed, direction, lifetime, drift (AWESOME ;p), spawntime I'm going to upload a video when I finished implemented texture mode and acceration (and maybe some fancy gravitation/wind as well) [IMG]http://www.binarybit.ch/imgs/particles.jpg[/IMG] hm maybe some size variable would be useful as well (the constructor for the Particle spawner looks awful already ;p)
Pause menu! [img]http://i3software.org/s/SS-2011-08-19_01.24.17.png[/img]
basically, you shoot stuff, particles fly out, collect particles before they fade away, and that gives you energy. fill your energy and you get better weapons. [IMG]http://i.imgur.com/il4Lf.png[/IMG] [IMG]http://i.imgur.com/NmCnk.png[/IMG] other than that, I can't seem to come up with another neat mechanic... any ideas?
[QUOTE=Richy19;31826860]How do you make it output the run time? dohh just noticed time [editline]19th August 2011[/editline] This is squirrel's [code] time ./sq a.nut real 0m0.009s user 0m0.007s sys 0m0.001s [/code] and the code: [code] function fib(n) { local a = 1 local b = 0 local i = 0 for(local i = 0; i < n; i++) { local c = b b = a a += c } return a } fib(100000) [/code] Its the right code right? This is the time if i print out the output [code] time ./sq a.nut 679394397 real 0m0.011s user 0m0.006s sys 0m0.003s [/code] the 679... is the result[/QUOTE] That looks very wrong. The wolframalpha says this is the correct result: 2.59740693472217241661550340212759154148804853865176... × 10^20898
You guys have so awesome games... Shame I can not think of any games I could make. I'm not a really good idea-man, so could you give me some ideas?
[QUOTE=Robber;31828473]That looks very wrong. The wolframalpha says this is the correct result: 2.59740693472217241661550340212759154148804853865176... × 10^20898[/QUOTE] 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=Foda;31828469]basically, you shoot stuff, particles fly out, collect particles before they fade away, and that gives you energy. fill your energy and you get better weapons. [IMG]http://i.imgur.com/il4Lf.png[/IMG] [IMG]http://i.imgur.com/NmCnk.png[/IMG] other than that, I can't seem to come up with another neat mechanic... any ideas?[/QUOTE] dat glow
[QUOTE=Robber;31828473]That looks very wrong. The wolframalpha says this is the correct result: 2.59740693472217241661550340212759154148804853865176... × 10^20898[/QUOTE] same code in C++ [cpp] #include <iostream> int main() { int n = 100000; int a = 1; int b = 0; for(int i = 0; i < n; i++) { int c = b; b = a; a += c; } std::cout << a << std::endl; return 0; } [/cpp] gave me the same [code] time ./Tester 679394397 real 0m0.002s user 0m0.001s sys 0m0.001s [/code]
[QUOTE=Foda;31828469]basically, you shoot stuff, particles fly out, collect particles before they fade away, and that gives you energy. fill your energy and you get better weapons. [I]snip[/I] other than that, I can't seem to come up with another neat mechanic... any ideas?[/QUOTE] Have different colour particlse that when you collect them it builds up a like-coloured glow around the ship, press a special weapon button and it's all discharged in a glorious particle beam (bigger with more charge of course)
Well, C# did the Fibonacci thing it in 3 ms for me. [csharp]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(); Console.WriteLine(Fibonacci(100000)); timer.Stop(); Console.WriteLine(timer.ElapsedTicks / (float)Stopwatch.Frequency * 1000); Console.ReadKey(); }[/csharp]
[QUOTE=Darwin226;31829606]Well, C# did the Fibonacci thing it in 3 ms for me. [csharp]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(); Console.WriteLine(Fibonacci(100000)); timer.Stop(); Console.WriteLine(timer.ElapsedTicks / (float)Stopwatch.Frequency * 1000); Console.ReadKey(); }[/csharp][/QUOTE] [code] time mono ./timer.exe 679394397 real 0m0.076s user 0m0.040s sys 0m0.015s [/code]
[QUOTE=Richy19;31829743][code] time mono ./timer.exe 679394397 real 0m0.076s user 0m0.040s sys 0m0.015s [/code][/QUOTE] Are you sure time doesn't add the JIT compilation to the total time?
[QUOTE=Darwin226;31829881]Are you sure time doesn't add the JIT compilation to the total time?[/QUOTE] I'm pretty sure it does.
[QUOTE=Darwin226;31829881]Are you sure time doesn't add the JIT compilation to the total time?[/QUOTE] It probly does, but TBH I think we should take that into consideration. The laguage needs the JIT compilation in order to work so it should also be added to the amount of time. That makes it loose in terms of speed when its a small program like this but it would be at an advantage with a big program.
[QUOTE=Richy19;31829929]It probly does, but TBH I think we should take that into consideration. The laguage needs the JIT compilation in order to work so it should also be added to the amount of time. That makes it loose in terms of speed when its a small program like this but it would be at an advantage with a big program.[/QUOTE] 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.
:3 [img]http://www.facepunch.com/fp/ratings/rainbow.png[/img] [img]http://img840.imageshack.us/img840/4286/41abdaf978ed0e2dc013bda.png[/img]
[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] Then calculate it like 100 times and benchmark that instead :v:
[QUOTE=likesoursugar;31830002]:3 [img]http://www.facepunch.com/fp/ratings/rainbow.png[/img] [img]http://img840.imageshack.us/img840/4286/41abdaf978ed0e2dc013bda.png[/img][/QUOTE] How are you storing map data?
[QUOTE=Richy19;31830029]How are you storing map data?[/QUOTE] [cpp]m_mapData.m_data = new unsigned char[MAP_SIZE_FULL];[/cpp]
Sorry, you need to Log In to post a reply to this thread.