multicore
5
[置顶] 宣传一下
长春商都历时半年,参与开发人员6个,终于在这个月开花了。另外公司长春优狐科技开发有限公司终于成立,也拿到了各种文件。值得庆贺。
欢迎各位朋友给点指点建议:
地址:
http://www.changchunshop.com
有合作意向的也可以联系我。
商都开花之后,心愿也了了,下面的运作参与的会少一些。把主要精力将投入到其他的建设中,预祝一切顺利。
欢迎各位朋友给点指点建议:
地址:
http://www.changchunshop.com
有合作意向的也可以联系我。
商都开花之后,心愿也了了,下面的运作参与的会少一些。把主要精力将投入到其他的建设中,预祝一切顺利。
| 引用(0)
1. Use StringBuffer instead of String because of the fact the String object can not
be changed. Any modification to a String variable is actually a new object
creation.
2. Accessing class variables directly is faster then using setter and getter
methods
3. Using local variables are more efficient then instance/class variables
4. Using variables are more efficient then arrays.
5. Avoid synchronization in loops because there is an extra over head to lock and
unlock each time the loop occurs
6. Counting down in loops is faster then counting up
7. Use compound operators like x += 1 instead o f x = x + 1 because fewer byte
codes is generated
8. Remove constant calculations in loops
9. Reuse objects
10. Assign null to unused objects, especially unused threads
11. Try to use already built in methods, for example if you want to copy data from
one array to another use System.arraycopy more then likely this method will
be more efficient then the one you created yourself
be changed. Any modification to a String variable is actually a new object
creation.
2. Accessing class variables directly is faster then using setter and getter
methods
3. Using local variables are more efficient then instance/class variables
4. Using variables are more efficient then arrays.
5. Avoid synchronization in loops because there is an extra over head to lock and
unlock each time the loop occurs
6. Counting down in loops is faster then counting up
7. Use compound operators like x += 1 instead o f x = x + 1 because fewer byte
codes is generated
8. Remove constant calculations in loops
9. Reuse objects
10. Assign null to unused objects, especially unused threads
11. Try to use already built in methods, for example if you want to copy data from
one array to another use System.arraycopy more then likely this method will
be more efficient then the one you created yourself
| 引用(0)
不知道是否还有人提及多核时代会带来编程业界的重大变化,或者说软件的UML模型的改变。由于多核不再是基于传统线程,而是基于任务的,《任务化多核编程》====【Multicore Programming based-on task】 和微软的TPL应该是一致的,有时间整理此文也会受益良多。唯一可惜的是TPL还是基于.NET运行库,应该可以根据TPL思想,整理出来独立的TPL库发布应该会有很大的价值。
在思考多核的时候,如果能从操作系统底层支持多核的话,相信无论是开发还是效率都将提升很多,这将是多核的出路,而从系统之上的应用层去使用多核,必将给多核效率打上折扣。这是毋庸置疑的。
计算机已经进入多核时代,而我们的程序依然没有跟进,最近在申报项目的时候,涉及到此类技术,整理小文,抛砖引玉。很多资料来源于互联网。


2009/03/15
12:34
1918




