C ++ vursus汇编。 [英] C++ vursus Assembly.

查看:83
本文介绍了C ++ vursus汇编。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种编程语言来设计激光软件,如皮秒甚至更小(飞秒)。我的问题是,我应该使用c ++或Assembly来设计激光软件吗?有些人说程序员编写的汇编代码不一定是优秀编译器创建的汇编代码,因此,最好的选择是使用c ++编写激光软件,一般情况下,速度为至关重要。另一方面,装配非常困难。

我的第二个问题是我编写了MATLAB程序,由于速度的原因,我现在用c ++编写。真的是MATLAB,一个不适合设计软件的软件,速度对它们至关重要吗?

I need a programming language for designing a laser software for very small times like picosecond or even smaller (femtosecond). My question is that , should I use c++ or Assembly for designing a laser software? Some persons say that Assembly codes written by a programmer, aren't necessarily optimum with respect to those created by a good compiler and therefore, say that best choice, is writing with c++ for a laser software and in general, a software that speed is vital to it. From other hand, Assembly is very difficult.
My second question is that I wrote MATLAB programs and because of speed, I write now with c++. Is really MATLAB, a unsuitable software for designing softwares that speed is vital for them?

推荐答案

对于高性能/硬实时/设备控制应用程序,首先使用C ++ 。如果它的轮廓太慢,找到性能瓶颈的位置,并用适当的汇编语言重新编码。
For high performance/hard real-time/device control applications start off using C++. If it's too slow profile it, find where the performance bottlenecks are and recode them in the appropriate assembly language.


你能说明为什么需要它在这么短的时间内工作。 />
C ++是一种非常好的编程语言,但不比汇编语言快。有些事情会使它变慢。尝试找到并纠正它们并按照Ascleal的说法进行更正。



如果由于速度而更受欢迎,那么装配是另一方面它是非常困难的语言。从汇编制作程序将花费很长时间,并且可能在程序中产生许多错误(人为错误,即由于混淆而由您完成的错误)。



我的意见将是c ++,因为它易于理解(比装配更好)并提供良好的性能。您可以更改c ++应用程序的汇编代码以使其更快。



对于任何拼写错误(因为它是从我的手机输入)抱歉。
Can you specify why do you need it to work in such less time.
C++ Is a very good programming language but not faster than assembly. There are some things which make it slow. Try to find them and correct them and correct them as Ascleal said.

Assembly if more preferred due to speed but on the other hand it is very difficult language. Making a program from assembly will take very long time and can create many errors in the program( human errors i.e errors done by you due to confusion).

My opinion will be c++ as it's easily understandable ( better than assembly) and provides good performance. You could change the assembly code of c++ applications to make it more faster.

Sorry for Any spelling mistakes( as it is typed from my phone).


虽然解决方案1中的答案是完全正确的,但我有一些严重的怀疑,即你的目标实际上接近现实。要执行任何有意义的计算,您将很难找到一个可以在不到1纳秒的时间内计算出来的处理器。考虑在低于此时间尺度的实时关注是不切实际的。



更重要的是,您正在与硬件接口,硬件本身也会导致信号处理延迟。最常见的硬件设备的反应时间在微秒范围内。如果你需要纳秒,它将变得昂贵。低于那个? - 我甚至不知道它是否存在!



换句话说,如果你想进入皮秒范围,你的顾虑应该是硬件传感器和演员界面:这些将是瓶颈,而不是编程!





PS:只是为了让你了解我检查的可能性ADC(模拟数字转换器),其中一个您需要解释任何外部信号负责触发您的程序: http://en.wikipedia.org/wiki/Analog-to-digital_converter [ ^ ]:

While the answer in solution 1 is entirely correct, I have some serious doubts that your goals are in fact anywhere close to reality. To perform any meaningful computation, you'd be hard pressed to find a processor which can compute it in less than 1 nanosecond. Considering real-time concerns at a timescale lower than that is simply unrealistic.

More importantly, you're interfacing with hardware, which itself also generates delays in signal processing. Most common hardware devices have reaction times in the microsecond range. If you need nanoseconds, it will get expensive. Lower than that? - I don't even know if it exists!

In other words, if you want to get into picosecond range, your concerns should be the hardware sensor and actor interfaces: these will be the bottleneck, not the programming!


P.S.: just to give you an idea of what is possible I checked on ADCs (analog digital converters), one of which you'll need to interpret whatever external signal is responsible for triggering your program: http://en.wikipedia.org/wiki/Analog-to-digital_converter[^]:
引用:

Flash ADC肯定是最快的这三种类型。转换基本上在单个并行步骤中执行。对于8位单元,转换发生在几十纳秒内。

Flash ADCs are certainly the fastest type of the three. The conversion is basically performed in a single parallel step. For an 8-bit unit, conversion takes place in a few tens of nanoseconds.



由于转换是并行执行的,因此(需要多少位)无关紧要,但最终你只需要一个纳秒的很大一部分来调用你的程序。因此,即使使用超级计算机,如果你有一台超级计算机,你也无法在皮秒范围内实际编程实时响应,更不用说femto秒了!


Since the conversion is performed in parallel, it won't matter (much) how many bits you require, but in the end you'll need a significant fraction of a nanosecond just to invoke your program. So even with a super computer, if you had one, you can't realistically program for a real-time response in the picosecond range, let alone femto second!


这篇关于C ++ vursus汇编。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆