Jump to content

  • Log In with Google      Sign In   
  • Create Account

cstony

Member Since 08 Mar 2007
Offline Last Active Yesterday, 06:26 AM

#5181932 Cache coherence and containers

Posted by cstony on 21 September 2014 - 12:14 PM

We still need more information about how you are using the map to give you a helpful answer.

 

Do you really need to put the pointers to the vector elements in the map? You are trying to setup the map so that you can iterate over to give the same sequence as the vector. In doing this, you propose to store a pointer to each element, this means that you need to do a pointer dereference for every element in the vector. Can you not simply iterate over the vector and then the map or vice versa? Can the elements in the map not be added to the vector?

 

You mention cache coherence so I'm assuming this is for performance purposes? Have you got a performance problem that needs resolving? Have you used a profiler to ensure you are 'optimising' the correct part of your program?




#5181118 c++ Performance boost needed

Posted by cstony on 17 September 2014 - 03:03 PM

 

  1. Yes, operator[] is a little slower, especially if you have exceptions/etc turned on; it checks whether range is valid, etc. However your loop isn't big enough to make a any noticeable difference

 

 

operator[] does not does not do bounds checking on a std::vector, the at(size_t) member function does do bounds checking and will throw an out_of_range exception. As for it not being inlined. As for inlining as asked by OP, this would vary from compiler to compiler. operator[] is a trivial function and I doubt the fact it is in a loop would prevent it being inlined. You would have to check the assembly code.

 

Also it's worth repeating what has already been said, when you are really aiming for performance gains a good profiling tool is an absolute must!




#4856057 Legalizing my Game

Posted by cstony on 31 August 2011 - 05:17 PM

I seriously got negged for that? Wow... someone needs to lighten up.

*preps for another neg on this post. weeeee*


OFF TOPIC How do you even give a neg vote now? I didn't think it was possible. I thought we adopted the 'like' culture.

ON TOPIC I'm not involved in your project and dont know the finer details. However, as an outsider, it feels like you are trying to screwing your colleagues over somewhat. It looks like you have outsourced the work you couldn't undertake yourself and now you want to reap the majority of the benefits and pass on as little as possible to the other contributers. I don't mean to sound like an ass but I think everyone should be fairly compensated. You don't mention any percentages so could I be completely off the mark but saying "I want to make sure that when I sell this game, all the profits will go to me, then I will pay my 'team' according to their effort" sounds like you will be taking the vast majority. I think you should show more respect to the rest of the team and hopefully you will work on more projects in the future :)

I must also add, congrats on taking a project this far though :)


#4831813 Performance with different compilers

Posted by cstony on 06 July 2011 - 09:12 AM

How are you running your app? If from within the IDE make sure you use CTRL-F5 (start without debugging) as opposed to just F5 (Debug).


#4786974 Vector field for magnetic di-poles

Posted by cstony on 17 March 2011 - 06:50 AM

I'm confused to what you actually want. LIC is a visualization technique. Do you want to create a simulation that constructs the vector field? Or have you got already got the vector field data and want to perform LIC to visualize it? Or both?

Assuming you are talking about the visualization aspect, finding an off-the-shelf LIC implementation might be hard due to varying grid types and data formats for the vector field data. Here is a link to some LIC C code (it's not OpenGL though). It might still be useful for you to get a grasp of the idea.

LIC code

If this isn't helpful let me know and I will dig out my C++/OpenGL implementation of LIC for you. It's not a stand alone library but you can have the class source to see how I did it. It's also not the best implementation, as it was a quick hack, but the results looked good and it ran at a reasonable rate.

Does it have to be LIC? You could try something IBFV (theres some example code on there too), which gives similar results but should be faster.


#4769555 The GD Coding Typo Dictionary (TM)

Posted by cstony on 04 February 2011 - 09:15 AM

This pearl catches me out every once in a while.
if(x = y)
{
   .....
}



PARTNERS