• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
KingofNoobs

New is SLOW!

27 posts in this topic

[quote name='KingofNoobs' timestamp='1354568007' post='5006769']
Also, I have never heard the word "noddy."
[/quote]

:)

Not sure if it's just British English, but it's slang for "simplistic".
1

Share this post


Link to post
Share on other sites
The best way to look at the allocation speed issue, in my opinion, is this: Your computer (or your customer's computer) does so and so many things in so and so much time. Sometimes that matters, and sometimes you just couldn't care less.

My system does 100 million new/delete pairs in 12.3 seconds. Which means no more and no less than if I do 8130 allocations per second (at 60 FPS, that's 130 allocations per frame), this will eat 1 millisecond. If I do 813, it will only eat 0.1 milliseconds. If 0.1 milliseconds are OK, then why bother? I don't need to care. When your program runs fast enough so it's capped by vertical sync, there's no gain if it starts blocking half a millisecond earlier.

On the other hand, if application performance tells me (and if profiling shows that it's a significant factor at all!) that I can't afford those 0.1 milliseconds, I have to make a plan to do fewer allocations. Edited by samoth
1

Share this post


Link to post
Share on other sites
[quote name='KingofNoobs' timestamp='1354539654' post='5006582']Hello all.

I just ran the following two functions 100 times each ...[/quote]

When using MSVC your code is translated like this:
[source lang="plain"]?passing@@YAXH@Z (void __cdecl passing(int)):
00000000: C3 ret

?referrencing@@YAXPAH@Z (void __cdecl referrencing(int *)):
00000010: 56 push esi
00000011: BE 40 42 0F 00 mov esi,0F4240h
00000016: 6A 04 push 4
00000018: E8 00 00 00 00 call ??2@YAPAXI@Z
0000001D: 50 push eax
0000001E: E8 00 00 00 00 call ??3@YAXPAX@Z
00000023: 83 C4 08 add esp,8
00000026: 4E dec esi
00000027: 75 ED jne 00000016
00000029: 5E pop esi
0000002A: C3 ret[/source]
As you can see, the first function, [font=courier new,courier,monospace]passing[/font], is reduced to a single [font=courier new,courier,monospace]ret[/font] instruction making it equivalent to this one:
[source lang="cpp"]void passing(int j )
{
}[/source]
In other words, through optimization algorithms the comiler "concludes" (notice the qutation marks because we a talking about a piece of software) that the loop is redundant and removes it entirely from the function body. However, in [font=courier new,courier,monospace]referrencing[/font] the loop is translated because two external functions (the [font=courier new,courier,monospace]int[/font] constructor and -destructor) are called in each iteration. And even though it may seem like this could be optimized out of the loop as well, as soon as you invoke an external function things change quite significantly from a complier's "point of view" because the function's implementation isn't part of your code and is stored in binary form in some library (or object) file on your hard-drive.

I hope this answers your question.
1

Share this post


Link to post
Share on other sites
[quote name='Dragonion' timestamp='1354644568' post='5007148']
However, in referrencing the loop is translated because two external functions (the int constructor and -destructor) are called in each iteration.
[/quote]
The int constructor and destructor are trivial and not present in the compiler's output. The two function calls you see are the memory allocation and deallocation.
0

Share this post


Link to post
Share on other sites
[quote name='Álvaro' timestamp='1354645307' post='5007155']
[quote name='Dragonion' timestamp='1354644568' post='5007148']
However, in referrencing the loop is translated because two external functions (the int constructor and -destructor) are called in each iteration.
[/quote]
The int constructor and destructor are trivial and not present in the compiler's output. The two function calls you see are the memory allocation and deallocation.
[/quote]

True. But for the sake of simplicity I took the liberty of using the words "constructor" and "destructor" as aliases for the entire memory allocation/de-allocation processes they initiate when you use them. Edited by Dragonion
-1

Share this post


Link to post
Share on other sites
As the assembly Dragonion posted shows:

It just goes to show that nothing is faster than something, and something is slower than nothing.[img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img] Edited by iMalc
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0