Search:

Type: Posts; User: rcgldr

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    2
    Views
    443

    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
  2. 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.
  3. 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...
  4. Replies
    15
    Views
    1,490

    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
  5. 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...
  6. Replies
    15
    Views
    1,490

    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,...
  7. Replies
    15
    Views
    1,490

    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.
  8. Replies
    15
    Views
    1,490

    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...
  9. Replies
    15
    Views
    1,490

    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...
  10. Replies
    15
    Views
    1,490

    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...
  11. Replies
    15
    Views
    1,490

    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...
  12. Replies
    15
    Views
    1,490

    ... 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...
  13. Replies
    15
    Views
    1,490

    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...
  14. Replies
    17
    Views
    1,121

    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]; ...
  15. 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...
  16. Thread: quick sort

    by rcgldr
    Replies
    10
    Views
    355

    You could change the code to the example shown...

    You could change the code to the example shown below, but a compiler may already be optimizing the original code to essentially the same thing.



    while(1)
    {
    ...
  17. What operating system? In the case of windows,...

    What operating system? In the case of windows, mutexes and semaphores are "handles", and creating an array of handles is not an issue, and is required if using WatiForMultipleObjects.
    ...
  18. In that case: typedef struct{ char...

    In that case:



    typedef struct{
    char str[20];
    }mystruct;


    int main()
  19. C / C++ don't allow array assignment. Structures...

    C / C++ don't allow array assignment. Structures can be used:



    typedef struct{
    char str[20];
    }mystruct;


    int main()
  20. Thread: Fibonacci

    by rcgldr
    Replies
    2
    Views
    456

    fibonacci() returns an unsigned long long, but...

    fibonacci() returns an unsigned long long, but the printf is using "%d", which is for a signed int. For Visual Studio, the printf would use "%llu" for an unsigned long long.
  21. Not as fast. The instruction pshufb will shuffle...

    Not as fast. The instruction pshufb will shuffle the bytes and insert 0's in 1 cycle, and the operations on two separate xmm registers occur in parallel.
  22. Probably picking up more than one character at a...

    Probably picking up more than one character at a time, which would be processor dependent. In assembly on X86 with xmm registers, you could load 16 bytes at a time, copy to another xmm register, then...
  23. It's probably simpler to implement a...

    It's probably simpler to implement a non-recursive quicksort using a queue. Example pseudo code with Lomuto partition scheme:

    Can we use a queue in quicksort in C? - Quora
  24. There is an alternative method, but it requires a...

    There is an alternative method, but it requires a bit of insight to sum up bit fields in parallel.



    #include <stdio.h>
    int main()
    {
    int x ;
    printf("Enter...
  25. Replies
    7
    Views
    601

    I've already posted that this depends on the...

    I've already posted that this depends on the specific implementation of quicksort. The example I mentioned doesn't move the pivot or any elements equal to the pivot. A standard Hoare partition...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4