<legend id='cbmz1'><style id='cbmz1'><dir id='cbmz1'><q id='cbmz1'></q></dir></style></legend>
    <i id='cbmz1'><tr id='cbmz1'><dt id='cbmz1'><q id='cbmz1'><span id='cbmz1'><b id='cbmz1'><form id='cbmz1'><ins id='cbmz1'></ins><ul id='cbmz1'></ul><sub id='cbmz1'></sub></form><legend id='cbmz1'></legend><bdo id='cbmz1'><pre id='cbmz1'><center id='cbmz1'></center></pre></bdo></b><th id='cbmz1'></th></span></q></dt></tr></i><div id='cbmz1'><tfoot id='cbmz1'></tfoot><dl id='cbmz1'><fieldset id='cbmz1'></fieldset></dl></div>
    • <bdo id='cbmz1'></bdo><ul id='cbmz1'></ul>

    <small id='cbmz1'></small><noframes id='cbmz1'>

    1. <tfoot id='cbmz1'></tfoot>
    2. 为什么 Julia 不能超集 python?

      Why couldn#39;t Julia superset python?(为什么 Julia 不能超集 python?)

      <small id='EROEk'></small><noframes id='EROEk'>

      • <bdo id='EROEk'></bdo><ul id='EROEk'></ul>

              • <i id='EROEk'><tr id='EROEk'><dt id='EROEk'><q id='EROEk'><span id='EROEk'><b id='EROEk'><form id='EROEk'><ins id='EROEk'></ins><ul id='EROEk'></ul><sub id='EROEk'></sub></form><legend id='EROEk'></legend><bdo id='EROEk'><pre id='EROEk'><center id='EROEk'></center></pre></bdo></b><th id='EROEk'></th></span></q></dt></tr></i><div id='EROEk'><tfoot id='EROEk'></tfoot><dl id='EROEk'><fieldset id='EROEk'></fieldset></dl></div>
                <tfoot id='EROEk'></tfoot>
                  <tbody id='EROEk'></tbody>
                <legend id='EROEk'><style id='EROEk'><dir id='EROEk'><q id='EROEk'></q></dir></style></legend>
              • 本文介绍了为什么 Julia 不能超集 python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                The Julia Language syntax looks very similar to python, while the concept of a class (if one should address it as such a thing) is more what you use in C. There were many reasons why the creators decided on the difference with respect to the OOP. Still would it have been so hard (in comparison to create Julia in first place which is impressive) to find some canonical way to interpret python to Julia and thus get a hold of all the python libraries?

                解决方案

                Yes. The design of Python makes it fundamentally difficult to optimize at compile-time (i.e. before you run the code). It is simply false that Julia is fast BECAUSE of its JIT. Rather, Julia is designed with its type system and multiple dispatch in mind so that way the compiler can know all of the necessary details to compile "the same code you would have written in C". That's what makes it fast: the type system. It makes a few trade-offs that allow it to, in "type-stable" functions, fully deduce what the types of every variable is, know what the memory layout of the type should be (including parametric types, so Vector{Float64} has a memory layout which is determined by the type and its parameter which inlines Float64 values like a NumPy array, except this is generalized in a way that your own struct types get the same efficiency), and compile a version of the code specifically for the types which are seen.

                There are many ways where this is at odds with Python. For example, if the number of fields in a struct could change, then the memory layout could not be determined and thus these optimizations cannot occur at "compile-time". Julia was painstakingly designed to make sure that it would have type inferrability, and it uses that to generate code which is fully typed and remove all runtime checks (in type-stable functions. When a function is not type-stable, the types of the variables become dynamic rather than static and it slows down to Python-like speeds). In this sense, Julia actually isn't even optimized yet: all of its performance comes "for free" given the design of its type system. Python/MATLAB/R has to try really hard to optimize at runtime because it doesn't have the capability to do these deductions. In fact, those languages are "better optimized" right now in terms of runtime optimizations, but no one has really worked on runtime optimizations in Julia yet because in most performance sensitive cases you can get it all at compile time.

                So then, what about Numba? Numba tries to take the route that Julia takes but with Python code by limiting what can be done so that way it can get type-stable code and compile that efficiently. However, this means a few things. First of all, it's not compatible with all Python codes or libraries. But more importantly, since Python is not a language built around its type system, the tools for controlling the code at the level of types is much reduced. So Numba doesn't have parametric vectors and generic codes which auto-specialize via multiple dispatch because these aren't features of the language. But that also means that it cannot make full use of the design, which limits how much it can do. It can handle the "use only floating point array" stuff just fine, but you can see it gets limited if you want one code to produce efficient code for "any number type, even ones I don't know about". However, by design, Julia does this automatically.

                So at the core, Julia and Python are extremely different languages. It can be hard to see because Julia's syntax is close to Python's syntax, but they do not work the same at all.

                This is a short summary of what I have described in a few blog posts. These go into more detail and show you how Julia is actually generating efficient code, how it gives you a generic "Python looking style" but doing so with full inferrability all the way down, and what the tradeoffs are.

                How type-stability plus multiple dispatch gives performance:

                http://ucidatascienceinitiative.github.io/IntroToJulia/Html/WhyJulia http://www.stochasticlifestyle.com/7-julia-gotchas-handle/

                How the type system allows for highly performant generic designs

                http://www.stochasticlifestyle.com/type-dispatch-design-post-object-oriented-programming-julia/

                这篇关于为什么 Julia 不能超集 python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Running .jl file from R or Python(从 R 或 Python 运行 .jl 文件)
                Running Julia .jl file in python(在 python 中运行 Julia .jl 文件)
                Using PIP in a Azure WebApp(在 Azure WebApp 中使用 PIP)
                How to run python3.7 based flask web api on azure(如何在 azure 上运行基于 python3.7 的烧瓶 web api)
                Azure Python Web App Internal Server Error(Azure Python Web 应用程序内部服务器错误)
                Run python dlib library on azure app service(在 azure app 服务上运行 python dlib 库)

                    <tbody id='TPggB'></tbody>
                  <legend id='TPggB'><style id='TPggB'><dir id='TPggB'><q id='TPggB'></q></dir></style></legend>

                  • <tfoot id='TPggB'></tfoot>

                    <small id='TPggB'></small><noframes id='TPggB'>

                        <bdo id='TPggB'></bdo><ul id='TPggB'></ul>
                        1. <i id='TPggB'><tr id='TPggB'><dt id='TPggB'><q id='TPggB'><span id='TPggB'><b id='TPggB'><form id='TPggB'><ins id='TPggB'></ins><ul id='TPggB'></ul><sub id='TPggB'></sub></form><legend id='TPggB'></legend><bdo id='TPggB'><pre id='TPggB'><center id='TPggB'></center></pre></bdo></b><th id='TPggB'></th></span></q></dt></tr></i><div id='TPggB'><tfoot id='TPggB'></tfoot><dl id='TPggB'><fieldset id='TPggB'></fieldset></dl></div>