算法分析工具,用于Java [英] Algorithm Analysis tool for java

查看:215
本文介绍了算法分析工具,用于Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一种算法分析工具,用于Java,可以计算出大功能的0。理想我想作的一部分我的构建过程中,沿着我的其他code度量工具的一面。即使在谷歌上搜索,我无法找到的商业工具,没有开源。任何建议将受到欢迎。

I am looking for an algorithm analysis tool for java that can calculate Big 0 of a function. Ideal I would like to make it part of my build process, along side of my other code metrics tool. Even after searching on google I am unable to find any opensource of commercial tool. Any suggestion would be welcome

感谢

推荐答案

这是不是就是通常可行的自动。大澳的分析不是一件简单的事情。

This isn't something that is generally doable automatically. Big-O analysis isn't a trivial thing.

你确定你不是在找一个探查呢?

Are you sure you're not looking for a profiler instead?

算法BIG-O分析通常是在设计阶段进行,在笔和纸。这可能是一些人编写简单的程序和使用自动化工具来测量和比较原型实现各种算法,帮助分析,但即使在这种高度假设的情况下,Java的不会是所选择的语言(Haskell中,也许)。

Big-O analysis of algorithms is usually done in the design phase, on pencil and paper. It's possible that some people write simple programs and use automated tools to measure and compare a prototype implementation of various algorithms to help the analysis, but even in that highly hypothetical case, Java would NOT be the language of choice (Haskell, maybe).

有关写在一个实际的(但理论上丑陋!)语言如Java,通常你设计和分析,一旦你把它翻译在Java中之前实施,则算法的应用程序,个人资料和优化的的/如果有必要的。在这一点上,你的的已经知道你的算法的大澳复杂性。

For applications written in a practical (but theoretically ugly!) language like Java, usually you design and analyze the algorithm prior to implementation, and then once you translate it in Java, you profile and optimize as/if necessary. At this point you should already know the Big-O complexity of your algorithm.

这可能是一个惊喜给你,但假设你有一些算法的实现,然后你优化它,使它现在快一倍。也许三次。也许快十倍。也许快一万倍!

It may be a surprise to you, but suppose you have an implementation of some algorithm, and then you optimize it so that it's now twice as fast. Maybe three times. Maybe ten times faster. Maybe a million times faster!!!

然而,在大澳的分析来看,其复杂性是一样的!的如果你有一个线性算法,改进的百万倍,快优化版本仍然是线性的!如果是二次的,它会继续这样做!

And yet, in terms of Big-O analysis, its complexity remains the same! If you had a linear algorithm, the improved million-times-faster optimized version is still linear! If it was quadratic, it will remain so!

这是因为一个常数因子是微不足道的渐进分析(即如何快速它成长为输入大小会走向无穷大?)。一百万是一个大数目,但它仍然只是一个常量。

This is because a constant factor is insignificant for asymptotic analysis (i.e. how fast does it grow as the input size goes toward infinity?). A million is a big number, but it's still just a constant.

另一个复杂的因素是,渐进分析实际上有一个门槛的之后的边界举行。也就是说,对于较小的输入,这些边界可以被打破,但向无穷这个阈值时开始,边界必须尊重。这使得自动分析被测量很辛苦,因为你不知道你是否已经达到阈值。

Another complicating factor is that asymptotic analysis actually have a threshold after which the bounds hold. That is, for smaller inputs, these bounds can be broken, but starting from this threshold towards infinity, the bounds must be respected. This makes automatic analysis by measurement very hard, since you don't know if you've reached the threshold or not.

我建议你阅读一些基本的计算机科学教科书,以了解更多的主题。

I recommend reading some elementary computer science textbooks to learn more of the subject.

有趣的事实:这是不可能判断一个程序都不会停止。这就是所谓的停机问题。它可能在最初看起来可笑,但是这有许多严重的理论后果。

Fun fact: it's impossible to tell if a program will ever stop. This is known as the halting problem. It may seems ridiculous at first, but this has many serious theoretical consequences.

  • How to calculate order (big O) for more complex algorithms (ie quicksort)
  • Big O, how do you calculate/approximate it?
  • Programmatically obtaining Big-O efficiency of code
  • Open Source Java Profilers
  • Please recommend a Java profiler

这篇关于算法分析工具,用于Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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