Python、Go和C++在N-Queens问题上的比较
Comparing Python, Go, and C++ on the N-Queens Problem
摘要:
Python目前是机器学习领域的主导语言,但经常因执行某些任务缓慢而受到批评。在本报告中,我们使用著名的$N$ -queens难题作为基准,以表明一旦使用Numba编译器编译,它在执行速度方面与C++和Go竞争,同时仍然允许非常快速的原型设计。这对顺序程序和并行程序都是如此。因此,在学术环境中出现的大多数情况下,使用普通Python开发,识别计算瓶颈并使用Numba消除它们是有意义的。
英文摘要:
Python currently is the dominant language in the field of Machine Learning but is often criticized for being slow to perform certain tasks. In this report, we use the well-known $N$-queens puzzle as a benchmark to show that once compiled using the Numba compiler it becomes competitive with C++ and Go in terms of execution speed while still allowing for very fast prototyping. This is true of both sequential and parallel programs. In most cases that arise in an academic environment, it therefore makes sense to develop in ordinary Python, identify computational bottlenecks, and use Numba to remove them.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。