Search:

Type: Posts; User: rcgldr

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: what is goto?

    by rcgldr
    Replies
    3
    Views
    575

    Sometimes goto is useful as shown in the threads...

    Sometimes goto is useful as shown in the threads linked to below. The first is about a 4 way merge sort that doesn't use a min-heap. The second is a more generic question. Typically goto is useful...
  2. Replies
    2
    Views
    428

    Visual Studio is not running some type of virtual...

    Visual Studio is not running some type of virtual mode. Instead, it knows the acceptable syntax for C / C++ and also some common errors, so it will produce errors or warnings as you type in code.
  3. Replies
    6
    Views
    667

    I forgot to reply to this before. It's possible...

    I forgot to reply to this before. It's possible that the amount of sensitivity to alignment may be specific to the Intel 3770K or any of the third generation of processors known as "Ivy Bridge",...
  4. Replies
    6
    Views
    667

    Example C++ code for Windows. Converting the code...

    Example C++ code for Windows. Converting the code to C is simple, but more effort would be needed to convert to Posix semaphores and threads. This example takes about 0.4 seconds to sort 36 million...
  5. Replies
    6
    Views
    667

    I modded a radix sort for 36 million psuedo...

    I modded a radix sort for 36 million psuedo random 64 bit integers, using (8,8,8,8,8,8,8,8) bit fields (8 passes), to use 4 threads corresponding to the 4 cores on my processor (Intel 3770K). The...
  6. Replies
    6
    Views
    667

    The code in the prior thread could use some minor...

    The code in the prior thread could use some minor tweaks to make it a bit faster, but it's at a point of diminishing returns. As pointed out in the prior thread, if sorting 64 bit unsigned integers,...
  7. This is similar to john.c's answer, but only...

    This is similar to john.c's answer, but only checks for a == NULL or b == NULL as needed, instead of a while that checks both for every node moved.



    ListNode * MergeLists(ListNode *a, ListNode...
  8. Replies
    53
    Views
    3,245

    One issue with the suggested solutions is that...

    One issue with the suggested solutions is that the results will be slightly biased due to rand%(x), where x ranges from 49 to 44. For example, if using a 32 bit random number generator modulo 49,...
  9. Replies
    10
    Views
    850

    By older compilers, I meant ones that aren't c89...

    By older compilers, I meant ones that aren't c89 compliant. This would include most 16 bit compilers for X86 (like Microsoft (although the last 16 bit tool set was released in 1994, I don't think...
  10. Replies
    10
    Views
    850

    Depending on the compiler (usually older ones),...

    Depending on the compiler (usually older ones), global variables may not be initialized, unless explicitly initialized, while static variables are initialized to zero by default.
  11. Replies
    2
    Views
    968

    There are two types of LFSR, Fibonacci and...

    There are two types of LFSR, Fibonacci and Galois. The question doesn't specify which type. Wiki article:

    Linear-feedback shift register - Wikipedia
  12. Those are possible explanations for variations in...

    Those are possible explanations for variations in run time, but they don't explain a consistent difference in run time (1.465 seconds versus 2.000 seconds) due to location of code.
  13. Possibly, but Windows non-I/O thread switches...

    Possibly, but Windows non-I/O thread switches only occur on tick boundaries, and at 64 hz, 2 seconds, that is 128 possible thread switches out of 1048576 calls to fib(), or 8192 calls per possible...
  14. Replies
    15
    Views
    2,318

    I posted it in the tech board section: ...

    I posted it in the tech board section:

    https://cboard.cprogramming.com/tech-board/177912-intel-3770k-~35%-time-difference-tight-loop-depending-location-other-cpus.html#post1288661
  15. Intel 3770K ~35% time difference in tight loop depending on location - other cpus?

    The code below is X86 64 bit assembly code to calculate the sum of Fib(0) to Fib(93). It includes a conditional to use either a tight loop or an unfolded loop with a computed jump to enter the...
  16. Replies
    15
    Views
    2,318

    One issue I found with 3770K was an unusual...

    One issue I found with 3770K was an unusual sensitivity to code location in tight loops. I was comparing 64 bit assembly code for Fibonacci number using a tight loop versus an unfolded loop,...
  17. Replies
    15
    Views
    2,318

    My prior testing was wrong, on my 3770K at...

    My prior testing was wrong, on my 3770K at 3.5ghz, 64 bit mode, original takes ~1.18, alternate ~1.26 seconds, about 6.6% slower, not much of a difference.
  18. Replies
    15
    Views
    2,318

    Can't you use the code from your prior post? I...

    Can't you use the code from your prior post? I made a different version of main, calls rand() multiple times since VS rand() only returns 15 bits (it also matches some other old code used for...
  19. Replies
    15
    Views
    2,318

    This code is used to handle the case where a...

    This code is used to handle the case where a single sorted run is all that is remaining to the end of the array, so it just does a copy of that single run. Calling Merge201 after that looks like it...
  20. Replies
    15
    Views
    2,318

    I never got a reply about the call to Merge201...

    I never got a reply about the call to Merge201 after doing a MergeCopy10.

    I'm also wondering if the original version is easier to follow than the alternate version. The original version...
  21. Replies
    15
    Views
    2,318

    Thanks The code in main needs to check the...

    Thanks

    The code in main needs to check the array pointed to by the returned pointer in "result" (instead of dest or source). To end up with the sorted array in the original array (not the working...
  22. Replies
    15
    Views
    2,318

    ... and in 1974, Donald Knuth wrote "Structured...

    ... and in 1974, Donald Knuth wrote "Structured Programming with go to Statements" (you can do a web search to find copies of the original paper). The point of creating this thread is that I rarely...
  23. Replies
    15
    Views
    2,318

    Sometimes "goto" is useful

    Here is an example of a 4 way (no minheap) bottom up merge sort, which is about 15% faster than a 2 way merge sort and about as fast (sometimes a bit faster) than quick sort, on a processor with 16...
  24. Replies
    17
    Views
    2,009

    Some examples ("%04p" prints a pointer with...

    Some examples ("%04p" prints a pointer with Microsoft compilers). The 3d matrix "c", could be static or global.



    #include <stdio.h>
    int main(int argc, char **argv)
    {
    int (*a)[5][5]; ...
  25. For an efficient sort, you could write a merge...

    For an efficient sort, you could write a merge function and then a merge sort function. Bottom up approach using a small (26 to 32) array of pointers is faster than top down approach which scans...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4