optimization

Are memory orderings: consume, acq_rel and seq_cst ever needed on Intel x86?

北战南征 提交于 2021-02-08 14:36:43
问题 C++11 specifies six memory orderings: typedef enum memory_order { memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; https://en.cppreference.com/w/cpp/atomic/memory_order where the default is seq_cst. Performance gains can be found by relaxing the memory ordering of operations. However, this depends on what protections the architecture provides. For example, Intel x86 is a strong memory model and

What causes page fault and how to minimize them?

不羁岁月 提交于 2021-02-08 14:10:11
问题 When examining a process in Process Explorer, what does it mean when there are several page faults? The application is processing quite a bit of data and the UI is not very responsive. Are there optimizations to the code that could reduce or eliminate page faults? Would increasing the physical RAM of the system make a difference? 回答1: http://en.wikipedia.org/wiki/Page_fault Increasing the physical RAM on your machine could result in fewer page faults, although design changes to your

What causes page fault and how to minimize them?

邮差的信 提交于 2021-02-08 14:08:57
问题 When examining a process in Process Explorer, what does it mean when there are several page faults? The application is processing quite a bit of data and the UI is not very responsive. Are there optimizations to the code that could reduce or eliminate page faults? Would increasing the physical RAM of the system make a difference? 回答1: http://en.wikipedia.org/wiki/Page_fault Increasing the physical RAM on your machine could result in fewer page faults, although design changes to your

What causes page fault and how to minimize them?

↘锁芯ラ 提交于 2021-02-08 14:05:56
问题 When examining a process in Process Explorer, what does it mean when there are several page faults? The application is processing quite a bit of data and the UI is not very responsive. Are there optimizations to the code that could reduce or eliminate page faults? Would increasing the physical RAM of the system make a difference? 回答1: http://en.wikipedia.org/wiki/Page_fault Increasing the physical RAM on your machine could result in fewer page faults, although design changes to your

May a pointer ever point to a cpu register?

拟墨画扇 提交于 2021-02-08 13:44:21
问题 I'm wondering if a pointer may point to a cpu register since in the case it may not, using reference instead of pointer where possible would give compiler opportunity to do some optimizations because the referenced object may reside in some register but an object pointed to by a pointer may not. 回答1: In general, CPU registers do not have memory addresses, though a CPU architecure could make them addressable (I;m not familar with any - if someone knows of one, I'd appreciate a comment).

Why is valarray so slow on Visual Studio 2015?

家住魔仙堡 提交于 2021-02-08 12:19:40
问题 To speed up the calculations in my library, I decided to use the std::valarray class. The documentation says: std::valarray and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword restrict in the C programming language. In addition, functions and operators that take valarray arguments are allowed to return proxy objects to make it possible for the compiler to optimize an expression

Why is valarray so slow on Visual Studio 2015?

痞子三分冷 提交于 2021-02-08 12:18:48
问题 To speed up the calculations in my library, I decided to use the std::valarray class. The documentation says: std::valarray and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword restrict in the C programming language. In addition, functions and operators that take valarray arguments are allowed to return proxy objects to make it possible for the compiler to optimize an expression

pcmpestri character units and countdown - x86-64 asm

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-08 11:12:14
问题 I’m trying to write a minimal loop around pcmpestri in x86-64 asm (actually in-line asm embedded in Dlang using the GDC compiler). There are a couple of things that I don’t understand I you are using pcmpestri with two pointers to strings, are the lengths of the strings in rax and rdx ? If so, what are the units? count in bytes always, or count in chars where 1 count = 2 bytes for uwords ? Does pcmpestri check for short strings? ie len str1 or str2 < 16 bytes or 8 uwords if uwords Does

Which sorting algorithm uses the fewest number of comparisons while elements are being added?

落花浮王杯 提交于 2021-02-08 10:48:35
问题 I have a lot of music and i want to rank them from least favorite to favorite (this will take many days). I would like to compare two music files at a time (2-way comparison). I saw some questions on algorithms with the fewest comparisons. But the catch is that (since it's a long process) i want to add new music to the collection and in that case i don't want to start over sorting everything (thus creating a lot more comparison steps). Which algorithm has the least amount of comparisons while

Which sorting algorithm uses the fewest number of comparisons while elements are being added?

亡梦爱人 提交于 2021-02-08 10:46:26
问题 I have a lot of music and i want to rank them from least favorite to favorite (this will take many days). I would like to compare two music files at a time (2-way comparison). I saw some questions on algorithms with the fewest comparisons. But the catch is that (since it's a long process) i want to add new music to the collection and in that case i don't want to start over sorting everything (thus creating a lot more comparison steps). Which algorithm has the least amount of comparisons while