Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

面向过程 :面向过程性能比面向对象高?? #431

Closed
ryouaki opened this issue Aug 8, 2019 · 17 comments
Closed

面向过程 :面向过程性能比面向对象高?? #431

ryouaki opened this issue Aug 8, 2019 · 17 comments
Labels

Comments

@ryouaki
Copy link

@ryouaki ryouaki commented Aug 8, 2019

面向过程 :面向过程性能比面向对象高。 因为类调用时需要实例化,开销比较大,比较消耗资源,所以当性能是最重要的考量因素的时候,比如单片机、嵌入式开发、Linux/Unix等一般采用面向过程开发。

----》》
这个并不是根本原因,面向过程也需要分配内存,计算内存偏移量,Java性能差的主要原因并不是因为它是面向对象语言,而是Java是半编译语言,最终的执行代码并不是可以直接被CPU执行的二进制机械码。

而面向过程语言大多都是直接编译成机械码在电脑上执行,并且其它一些面向过程的脚本语言性能也并不一定比Java好。

@guang19

This comment has been minimized.

Copy link

@guang19 guang19 commented Aug 11, 2019

@ryouaki 感谢,学习了

@mjiuming

This comment has been minimized.

Copy link

@mjiuming mjiuming commented Aug 18, 2019

@ryouaki 请教一下,是不是可以概括为:“程序的性能首先由编程语言的执行方式有关,其次才是设计范式”

@guang19

This comment has been minimized.

Copy link

@guang19 guang19 commented Aug 18, 2019

我觉得这个得分情况而定,c和c++就是很好的例子,两种语言执行效率差距其实并不大,但是两种语言的设计思想就不同。

@ryouaki

This comment has been minimized.

Copy link
Author

@ryouaki ryouaki commented Aug 18, 2019

@ryouaki 请教一下,是不是可以概括为:“程序的性能首先由编程语言的执行方式有关,其次才是设计范式”

设计范式和性能无关的。主要是编程语言的运行机制决定的。

@ryouaki

This comment has been minimized.

Copy link
Author

@ryouaki ryouaki commented Aug 18, 2019

我觉得这个得分情况而定,c和c++就是很好的例子,两种语言执行效率差距其实并不大,但是两种语言的设计思想就不同。

c和c++的运行机制是一样的。都是编译成机械码。

@guang19

This comment has been minimized.

Copy link

@guang19 guang19 commented Aug 18, 2019

感谢

@321cto

This comment has been minimized.

Copy link

@321cto 321cto commented Sep 1, 2019

收益了,感谢

@LiuRuiXiang

This comment has been minimized.

Copy link

@LiuRuiXiang LiuRuiXiang commented Sep 5, 2019

长知识了

@rockhu01

This comment has been minimized.

Copy link

@rockhu01 rockhu01 commented Nov 22, 2019

学习了

@Lotus-Blue

This comment has been minimized.

Copy link

@Lotus-Blue Lotus-Blue commented Nov 22, 2019

amazing gay

@konigsbergg

This comment has been minimized.

Copy link

@konigsbergg konigsbergg commented Dec 3, 2019

good job

@codingKings

This comment has been minimized.

Copy link

@codingKings codingKings commented Dec 7, 2019

到底是面向过程性能高还是面向对象性能高?这类问题很难回答,非要比较高低的话就必须设定一个场景,否则只能说是各有所长

@peacecoder

This comment has been minimized.

Copy link

@peacecoder peacecoder commented Dec 19, 2019

另外,现在java 性能不一定低,变化很大了

@ryouaki

This comment has been minimized.

Copy link
Author

@ryouaki ryouaki commented Dec 20, 2019

另外,现在java 性能不一定低,变化很大了

上半年刚测的。

@cjjMichael

This comment has been minimized.

Copy link

@cjjMichael cjjMichael commented Dec 31, 2019

感觉这个表述-"而是Java是半编译语言,最终的执行代码并不是可以直接被CPU执行的二进制机械码"不是很准确。最终执行代码不都是二进制码吗?(在此之前是低级语言代码,如汇编)个人觉得可以表述为编译过程的复杂程度的不同导致执行时间的不同(性能的主要度量)。第二,直接比较语言性能本来就是不恰当的。第三,现在的Java今非昔比,底层编译更加优化。第四,有限的测试不具有说服力,具体情况具体分析。

@cjjMichael

This comment has been minimized.

Copy link

@cjjMichael cjjMichael commented Dec 31, 2019

修正一下是"中间语言代码"。

@haichuanjiang

This comment has been minimized.

Copy link

@haichuanjiang haichuanjiang commented Jan 5, 2020

可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.