Symptom: When working from home using a company laptop, ever notice that the corporate laptop appears to be much slower on your home network? Well, I have had this problem for a while. After a closer look, I found whenever I switch to Windows Explorer or trying to open a file, it will take almost a minute for it to showup.
Root Cause: In my case, I found out the root cause is actually a bunch of network drives that are causing this performance problem.
There are 4 network mapped drives on my laptop which access various resources on intranet. Some are setup by IT so that they will be mapped whenever you boot you computer on company intranet. However, at home, connection to intranet is slow or non-existent. Whenever you make Windows Explorer visible or showing a File dialog, Windows explorer will try to map all of them one by one. That is, the more network drives you have, the longer you have to wait until Windows decide to give up on reconnecting these network drives.
Solution: I end up created a VB script to batch start/stop the mapping. At home with limit access to internet, I will run the scripts to stop all the mapped drives. At work, I will run the script to start the mapping.
The vb script to stop network drive:
Set objNetwork = CreateObject("WScript.Network")
On Error Resume Next
objNetwork.RemoveNetworkDrive "X:", "True"
objNetwork.RemoveNetworkDrive "Y:", "True"
objNetwork.RemoveNetworkDrive "Z:", "True"
To start network drive:
Set objNetwork = CreateObject("WScript.Network")
On Error Resume Next
objNetwork.MapNetworkDrive "X:" , "[your URI]"
objNetwork.MapNetworkDrive "Y:" , "[your URI]"
objNetwork.MapNetworkDrive "Z:" , "[your URI]"
Tips that make life of a software engineer easier. Well, not exactly. Some posts are open questions that I haven't found an answer ... yet
Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts
Tuesday, September 07, 2010
Friday, January 15, 2010
Performance Optimization for Embedded Systems
Some key points:
- Load code and data as much as possible into internal memory (L1 cache);
- Use compiler or linker options to optimize for code size can sometimes give better performance than optimize for performance (GreenHills has a very nice tool to help find the optimum compromise between optimize for speed and size). Major points for manipulation:
- Optimize for speed
- Optimize for size
- Remove unused functions
- Remove debug information
- Enable code cache
- Carefully tune the use of code cache and data cache. Performance difference between fine tuned layout and the default can be 10 time or more;
- Use integer, fixed point over float over double. If floating point computation is necessary, but double is not needed, then remember that all the constants MUST explicitly declared as floating precision, otherwise there may be a lot of double computation and float to double conversions. For example, instead of x=2.0; should use x=2.0f;
- Bit shift is faster than add (usually), add is faster than multiply (usually), multiply is faster than divide. So the following tricks usually are helpful:
- Use left shift and right shift instead of multi and div by 2, 4, 8, 16, 32, ... (integer only);
- Use add instead of multi 2, 3;
- If a number is used as divider many times, pre-calculate it's inverse, and use multiply for the calculations;
- Use left shift and right shift instead of multi and div by 2, 4, 8, 16, 32, ... (integer only);
- Blackfin (DSP architecture specific): assign data to A/B bank properly to enable parallel data retrieval;
- Profiler is your friend: use profiler to find the biggest consumer and focus on them;
- In C++ world: avoid deep hierarchy, because those practices take precious memory space which in turn have grave impact on performance;
- Be careful when you use C runtime. Call to "printf" can easily add 1k memory footprint;
Subscribe to:
Posts (Atom)