我在 Linux 5.4.0 下使用 Julia 1.5.2 并等待了大约 15 分钟的Pkg.add("DifferentialEquations"). 然后我在 Jupyter Notebook 中启动内核并运行以下代码。执行需要 1 分钟(实际上我第一次执行此操作需要 225 秒)。
t = time()
using Printf
using BenchmarkTools
using OrdinaryDiffEq
using Plots
tt = time() - t
@sprintf("It took %f seconds to import Printf, BenchmarkTools, OrdinaryDiffEq and Plots.", tt)
# It took 58.545894 seconds to import Printf, BenchmarkTools, OrdinaryDiffEq and Plots.
Run Code Online (Sandbox Code Playgroud)
最后,我做了和上面一样的,但是对于每个包。这是摘要:
Printf: 0.004755973815917969
BenchmarkTools: 0.06729602813720703
Plots: 19.99405598640442
OrdinaryDiffEq: 19.001102209091187
Run Code Online (Sandbox Code Playgroud)
我从知道这里是Pkg在过去慢,但我认为有15分钟不是在所有正常的安装时间。不过,这不是我的大问题。
我知道 Julia 需要在每次启动内核或加载某个包时编译所有内容。但这显然不是编译时间,而是编译永恒。
谁能弄清楚为什么这会如此缓慢?而且,如果这是正常的,那岂不是更好地提供预编译软件包Pkg,如numpy …
我有一个主要用 Python 编写的软件,现在,我使用PyInstaller以用户友好的方式捆绑和分发软件(它是我的 CI 管道的一部分,适用于 Linux 和 Windows)。
但是,我的表现很糟糕,我想用 Julia 重写一些重要的部分,同时将前端保留在 Python 中。我可以使用PyJulia来做到这一点,但这意味着用户必须手动安装 Julia 才能使用我的程序。
朱莉娅确实有PyInstaller相当于,这是PackageCompiler.jl,但我不知道该怎么称呼的东西与PackageCompiler.jl从Python方编制。
我怎样才能做到这一点,以便我可以捆绑和分发具有 Python、Julia 及其运行所需的一切的可执行文件?
我的最终用户是不知道什么是编程的人(化学家和药剂师)。他们没有 Python、Julia 或 Docker(他们甚至不想安装它)。
在我目前的方法中,与 PyInstaller 捆绑的软件由一个可执行文件组成,其中包含所有内容(Python 及其所需的一切)。我真正想要的是保持相同的用户体验,而且还有 Julia 在后台运行。
我将在 Julia 端实现几个函数,并且我想要(几乎)与 PyJulia 相同级别的集成。
也许我会去 Rust 并只使用 C 接口,但我真的很想使用 Julia。
谢谢你们的时间。
我想构建一个组件,它接受一个Icon参数并将所有其他参数传递给样式组件Input(基于TextInput)。在 Javascript 中,这非常简单:
import React from 'react';
import { TextInput } from 'react-native';
import styled from 'styled-components/native';
const Input = styled.TextInput`
color: #268596;
`;
export default ({ Icon, ...props }) => (
<InputArea>
<Icon fill="#268596" />
<Input {...props} />
</InputArea>
);
Run Code Online (Sandbox Code Playgroud)
但是,我想使用 Typescript (我是一个初学者)。我尝试了以下方法。
import React from 'react';
import { TextInputProps, TextInput } from 'react-native';
import styled from 'styled-components/native';
const Input = styled.TextInput`
color: #268596;
`;
type InputAreaProps = {
Icon: React.FC<React.SVGAttributes<SVGElement>>;
} & …Run Code Online (Sandbox Code Playgroud)