• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: The bug where terminal and xcode ran "different"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The bug where terminal and xcode ran "different"


  • Subject: Re: The bug where terminal and xcode ran "different"
  • From: "Theodore H. Smith" <email@hidden>
  • Date: Sun, 11 Feb 2007 17:41:34 +0000

I thought that the C++ containers had specific dynamics for specific operations?

They do. In fact, a vector is supposed to be just as efficient as an array. The vector::iterator family of typedefs is "implementation defined" so that an optimized library can just use a pointer as an iterator.

That's interesting. But the only thing that will convince me is a test :) Running on my computer.


C++ is quite good at creating very efficient code in this case.

I'm not so certain. I tend to avoid return by value in C++ because C+ + has really broken good OOP here. I prefer to create my objects on the stack and then fill my matrixes (or whatever it is) in a different function. RBV is OK for certain types like numbers or strings...


And you can tell vector to reserve space - a very similar technique to mallocing a large section of memory?

You can. And it is also supposed to be fairly efficient if it does need to resize. But if you are resizing frequently, a vector isn't the best choice.


Also, you can always derive your own classes from the standard libraries if you want and optimize those operations.

Are people using C++ containers for high-performance stuff (on xcode)?

I have seen very few people who write STL-based templatized code like I do. I assume they are out there somewhere, but I've met very few. There are still lots of C people who won't even consider using C++. In my experience, most C++ people are still stuck in OO design (I say "stuck" because their code still isn't done :). I wouldn't put too much effort into evangelizing. If someone wants to use C/ malloc/etc. you probably aren't going to change their mind at this point. After all, people should use what they like the best. I like C++. Others like Java. Help 'em if you can, move along otherwise.

For the most part I'll be using stl classes. But what about for when you want to write the highest performance stuff? For example, can I assume that a vector stores it's data linearly in RAM? if so, I could use the vector to allocate the memory, and then just access it with a pointer. The best of both I'd say! Either that or make a class which does exactly the same thing.


One problem I have with stl, is that it's not really "lowest common denominator". The nice thing about simple libraries is that they tend to be available everywhere.

Now that I think about it, I think that idea might be a bit silly. Maybe an idea to use STL even within high performance code? I suppose STL should be available everywhere Iw ant to go these days right?

I'm writing some fuzzy search algorithm, it can do spell check and a lot more than that because it's as general as Smith-Waterman. I've already made one that does levensthtein-like searches across database, a few years ago. Now I want to upgrade the algorithm to do Smith-Waterman-like searches across a database. I want to squeek out every last drop of CPU here. So doing my reading and writing to the RAM, using pointers is a MUST.

It uses 2D arrays, and data consequtiveness is also a must. I can't have my data scattered all over the RAM, that will kill caching. Such considerations are much easier to manage when I do my own pointer arithmetic, unfortunately. Unless I can get a class whose implementation is guaranteed to work as I wanted it. But that's probably not STL, and definitely NOT making a vector of vectors. For this case I really think pointer math is the way to go. Also, with the huge number of variables my code is using, using pointer math helps keep stuff in the registers by reducing variable count.

But the details of how my RAM is allocated and managed, I don't really care about as long as it's neat.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: The bug where terminal and xcode ran "different"
      • From: John Daniel <email@hidden>
    • Re: The bug where terminal and xcode ran "different"
      • From: Paul Walmsley <email@hidden>
    • Re: The bug where terminal and xcode ran "different"
      • From: Marshall Clow <email@hidden>
References: 
 >Re: The bug where terminal and xcode ran "different" (From: Rob Probin <email@hidden>)
 >Re: The bug where terminal and xcode ran "different" (From: John Daniel <email@hidden>)

  • Prev by Date: Re: The bug where terminal and xcode ran "different"
  • Next by Date: Re: The bug where terminal and xcode ran "different"
  • Previous by thread: Re: The bug where terminal and xcode ran "different"
  • Next by thread: Re: The bug where terminal and xcode ran "different"
  • Index(es):
    • Date
    • Thread