• Content count

  • Joined

  • Last visited

Community Reputation

684 Good

About Trap

  • Rank
  1. Quote:Original post by Lode Are there other/better techniques to make std::vectors have reasonable speed when NOT using optimization? Have you tried -O1 yet? It should compile a lot quicker and might be almost as fast as -O3.
  2. Is there a better way to address houses?

    The japanese way is quite different. If you can remember the -kus (that's quite easy) you have a rough idea of where something is, if you remember the first level of subareas in that -ku you can get within walking distance, but to find a house there you absolutely need a map. [Edited by - Trap on December 23, 2006 3:16:54 AM]
  3. With a smart algorithm and a bit of preprocessing searching a shortest path between random points in a 100k node grid is less than 1ms on a modern computer: smart algorithm For reducing the graph you could just delete nodes and adjust the adjacent edges in a way that retains connectivity. Do you store any kind of length for edges in your graph? You probably need it for the reduced graph.
  4. Can't you use the same method to create both a dense and a sparse graph?
  5. Is this practical

    Yep, if you use that scheme you soon will have 10 minute compile times for every change you make to any header file.
  6. Quote:Original post by Ready4Dis And remember, it's more efficient to read binary data than numerical data from a file, so a texture loader will run faster, because it can read in a very large buffer at once, without the need to process and convert data types. Binary files are more compact than text representations, so loading reading them is quicker, yeah. Converting data doesn't need to be a bottleneck, a harddisc tops at 100 MB/s, so you have around 20 cycles per byte to convert your data, that's more than enough for most reasonable ways of encoding data. Bulk reading is quicker in most circumstances, so you should try it even if you still need to convert the data you read.
  7. C++ streams usually aren't faster than cstdio. If you want to do it really fast, the best way probably is memory-mapping the file and using a special purpose parser.
  8. Random Number Generator

    You can either have exact distribution with unbounded runtime or fixed runtime with arbitrarily small unevenness in distribution. For the second one you just rescale your options to a bigger range. e.g. options 0,1,2 rescaled to 0-7: random value <-> result 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 The bigger you chose your upper limit, the smaller the unevenness.
  9. [java] Weird math

    Quote:Original post by AdamGL Thanks guys! I only need 2 decimal places, so I rounded all calculations. Thanks for the links!! Using weird math (aka. floating point math) for calculations without understanding it can result in wrong results. Not just results a tiny bit off, but completely wrong ones if your calculations are sophisticated enough. If you reasonably can calculate same stuff with integers then by all means do so.
  10. There is a research OS written in 90% .NET code: Singularity Most of an OS is just like any other program, the special stuff is those things: -making the computer load it at startup -changing existing software (especially compilers) to the conventions of your OS -interfacing with hardware -seperation of kernel and userland Using .NET for OS development means you need to change a .NET environment in a way that it can target the CPU without any underlying OS.
  11. I'm not sure if there is a C++ body, the MinGW g++ compiler seems to use a function written in assembly that just uses the FSIN instruction to do the real work.
  12. Do you just want a good way to compute these or do you really want to see how your compiler implements them? If it's the second: Use a disassembler.
  13. Isn't this just Gödels "any formal system with enough power is either incomplete or inconsistent"?