overhead

What exactly do pointers store? (C++)

最后都变了- 提交于 2019-12-05 06:12:41
I know that pointers store the address of the value that they point to, but if you display the value of a pointer directly to the screen, you get a hexadecimal number. If the number is exactly what the pointer stores, then when saying pA = pB; //both are pointers you're copying the address. Then wouldn't there be a bigger overhead to using pointers when working with very small items like int s and bool s? A pointer is essentially just a number. It stores the address in RAM where the data is. The pointer itself is pretty small (probably the same size as an int on 32 bit architectures, long on

How to turn off git 1.7.8 overhead for binary files (.doc, .pdf, etc)

五迷三道 提交于 2019-12-05 01:37:08
问题 I used git 1.7.4 for working with large svn repo - it was ok. I updated to git 1.7.8, and now, when I do "git svn dcommit" git do some superfluous work. In task manager, I see that it do about 1M of writes (I am using SSD, so it worries me). It shows warrnings for .pdf and .doc documents, which it didn't show for 1.7.4, for instance: "c:/Users/..../AppData/Local/Temp/SOMEHASH_documentName.doc is not a Word document", "Error: PDF file is damaged - attempting to reconstruct xref table" and

Terrible performance - a simple issue of overhead, or is there a program flaw?

ぐ巨炮叔叔 提交于 2019-12-04 23:41:48
问题 I have here what I understand to be a relatively simple OpenMP construct. The issue is that the program runs about 100-300x faster with 1 thread when compared to 2 threads. 87% of the program is spent in gomp_send_wait() and another 9.5% in gomp_send_post . The program gives correct results, but I wonder if there is a flaw in the code that is causing some resource conflict, or if it is simply that the overhead of the thread creation is drastically not worth it for a a loop of chunk size 4. p

Struct's contribution to type size

戏子无情 提交于 2019-12-04 04:27:17
I am wondering why the following two types struct { double re[2]; }; and double re[2]; have the same size in C? Doesn't struct add a bit of size overhead? No, it just merely composes all the elements into one higher-level element whose size is merely the individual elements' sizes added up (plus some padding depending on alignment rules, but that's out of the scope of this question). Not if it can help it - no. C avoids overhead like the plague. And specifically, it avoids overhead in this context. If you used a different structure, you might see a difference: struct space_filled { char part0;

Terrible performance - a simple issue of overhead, or is there a program flaw?

↘锁芯ラ 提交于 2019-12-03 15:28:55
I have here what I understand to be a relatively simple OpenMP construct. The issue is that the program runs about 100-300x faster with 1 thread when compared to 2 threads. 87% of the program is spent in gomp_send_wait() and another 9.5% in gomp_send_post . The program gives correct results, but I wonder if there is a flaw in the code that is causing some resource conflict, or if it is simply that the overhead of the thread creation is drastically not worth it for a a loop of chunk size 4. p ranges from 17 to 1000, depending on the size of the molecule we're simulating. My numbers are for the

OpenMP drastic slowdown for specific thread number

断了今生、忘了曾经 提交于 2019-12-03 14:23:06
I ran an OpenMP program to perform the Jacobi method, and it was working very well, 2 threads performed slightly over 2x 1 thread, and 4 threads 2x faster than 1 thread. I felt everything was working perfectly... until I reached exactly 20, 22, and 24 threads. I kept breaking it down until I had this simple program #include <stdio.h> #include <omp.h> int main(int argc, char *argv[]) { int i, n, maxiter, threads, nsquared, execs = 0; double begin, end; if (argc != 4) { printf("4 args\n"); return 1; } n = atoi(argv[1]); threads = atoi(argv[2]); maxiter = atoi(argv[3]); omp_set_num_threads

Learn about object overhead in JVM

丶灬走出姿态 提交于 2019-12-01 16:41:10
I am studying java, and I remember reading somewhere that java objects, had some overhead inside the JVM, which was used for administration reasons by the virtual machine. So my question is, can someone tell me if and how I can get an object's total size in the HotSpot JVM, along with any overhead it may come with? mikera You can't get the overhead directly. The amount of overhead is implementation dependent, and can vary based on a number of factors (e.g. the precise JVM version, and whether you are on a 32 or 64bit JVM). However it is reasonably safe to assume that in typical modern JVM

ctypes vs C extension

谁说胖子不能爱 提交于 2019-11-30 17:27:51
I have a few functions written in C for a game project. These functions get called quite a lot (about 2000-4000 times per second). The functions are written in C for raw speed. Now, the easiest way for me to include these functions into Python is to use ctypes . The alternative is to write a C extension to Python around these functions (which takes quite a bit of extra effort). So I wondered, not including the initial loading of the DLL, how big is the overhead of ctypes ? I'm using Python 2.7 (the standard CPython release), and I do not want to use an external library like Cython. I know this

Overhead in unused code

余生长醉 提交于 2019-11-30 11:46:01
I am wondering what the overhead is of having unused functions in your code. Say for example you have some debug logging, and you then give most of your objects a ToString() function that is being used in the debug logs. In a release build that debug logging is not being used. Is it then worth it removing the source code of those ToString() functions? (e.g. via Macro?) Or do they just make the executable marginally larger and otherwise don't impact performance? e.g. no speed impact? Or does the compiler or linker possibly even remove the functions if they are not used? If the compiler or

C++ Non-static member functions overhead

独自空忆成欢 提交于 2019-11-30 08:53:09
问题 I would like to know that, if we have the following class: class MyClass { public: MyClass(...) type nonstatic_func1(...); type nonstatic_func2(...); ... type nonstatic_func10(...); private: type var1; type var2; ... type var10; }; Will each instance of MyClass have its own set of ten functions (i.e. for each instance, will a "version" of each of the ten functions be created)? How much will having, say, 20 functions in a class definition impact performance, as opposed to having, say, 2