Rust语言编译成WASM)Wired Logic - a pixel-based digital circuit simulator running in a browser (Rust compiled into WASM).
wired-logic启发,wired-logic-rs是一个基于像素的数字电路模拟器,核心技术采用Rust和WebAssemblywasm-pack buildnpm install$ npm run serve # to start the webpack dev servernpm run bundle # to create the production bundle
Multiversion 0.5.0, now "production ready"
Multiversion - 是Rust语言支持多版本函数的属性宏.function multiversioning?大部分的CPU架构都有自己独特的指令集支持一些额外的功能。最常见的例子包括 x86/x86-64上的SSE & AVX,NEON上的ARM/AArch64指令集扩展Single Instruction, Multiple Data(SIMD)。这些指令集扩展可以给某些特殊的函数提升大量的运行速度。这些特殊的功能是不能胡乱的编译到一个 不支持这些特殊功能CPU的可执行文件里去的,那样往往会造成系统崩溃。
Function multiversioning是一种特殊的编译方法,通过编译包含特殊功能支持的不同版本的函数
能够在运行时runtime检测到这些特殊的功能并匹配不同的版本的可执行函数。clone属性宏来实现多版本函数,类似GCC的target_clonesuse multiversion::multiversion;fn square(x: &mut [f32]) {for v in x {*v *= *v;}}用multiversion和target属性宏来实现多版本函数.use multiversion::{multiversion, target};unsafe fn square_avx(x: &mut [f32]) {for v in x {*v *= *v;}}unsafe fn square_sse(x: &mut [f32]) {for v in x {*v *= *v;}}fn square(x: &mut [f32]) {for v in x {*v *= *v;}}
Active Rust developers estimated at 0.6 million (pdf, page 10)
How to install rust on Windows 10 (native)
Windows 10 2004的步骤:Build Tools for Visual Studio 2019,一般这个下载隐藏在微软下载链接的"Tools for Visual Studio 2019"下面。Build Tools for Visual Studio 2019 Installer并选择:C++ ToolsC++ Tools中还必须同时选择安装"Windows 10 SDK",安装程序提供多个版本,选最新的版本安装就好。cd %TEMP%cargo new toolchain_testcd toolchain_testcargo run"Hello, world!"cargo command not found的错误,你需要检查一下你的%PATH%看看是否设置好。Apache Spark的Rust语言绑定Rust bindings for Apache Spark
Ballista's的[Rust DataFrame](https://github.com/ballista-compute/ballista/blob/master/rust/src/dataframe.rs).创建一个逻辑查询计划,对一个CVS文件做聚合查询:let spark_master = "local[*]";let mut spark_settings = HashMap::new();spark_settings.insert("spark.app.name", "rust-client-demo");spark_settings.insert("spark.ballista.host", "localhost");spark_settings.insert("spark.ballista.port", "50051");let ctx = Context::spark(spark_master, spark_settings);let path = "/mnt/nyctaxi/csv/yellow/2019/yellow_tripdata_2019-01.csv";let df = ctx.read_csv(path, Some(nyctaxi_schema()), None, true)?.aggregate( vec![col("passenger_count")], // group by vec![min(col("fare_amount")), max(col("fare_amount"))] // aggregates)?;// print the query plandf.explain();// collect the results from the Spark executorlet results = df.collect().await?;// display the resultsutils::print_batches(&results)?;collect()函数会将逻辑计划编码成protobuf格式,
然后发送给在spark_settings设置中设置了服务端口并运行了Ballista Spark Executor执行器的远程服务器节点。Aggregate: groupBy=[[#passenger_count]], aggr=[[MIN(#fare_amount), MAX(#fare_amount)]]TableScan: /mnt/nyctaxi/csv/yellow/2019/yellow_tripdata_2019-01.csv projection=None+-----------------+-------+-----------+| passenger_count | MIN | MAX |+-----------------+-------+-----------+| 1 | -362 | 623259.86 || 6 | -52 | 262.5 || 3 | -100 | 350 || 5 | -52 | 760 || 9 | 9 | 92 || 4 | -52 | 500 || 8 | 7 | 87 || 7 | -75 | 78 || 2 | -320 | 492.5 || 0 | -52.5 | 36090.3 |+-----------------+-------+-----------+
== Physical Plan ==*(2) HashAggregate(keys=[passenger_count#3], functions=[min(fare_amount#10), max(fare_amount#10)])+- Exchange hashpartitioning(passenger_count#3, 200), true, [id=#18]+- *(1) HashAggregate(keys=[passenger_count#3], functions=[partial_min(fare_amount#10), partial_max(fare_amount#10)])+- *(1) Project [passenger_count#3, fare_amount#10]+- BatchScan[passenger_count#3, fare_amount#10] CSVScan Location: InMemoryFileIndex[file:/mnt/nyctaxi/csv/yellow/2019/yellow_tripdata_2019-01.csv], ReadSchema: struct<passenger_count:int,fare_amount:double>
上面的例子是用到了Apache Arrow Flight协议, 想了解更多请参阅SparkFlightProducer代码实现。
Upgrade Rust's Android SDK to API level 16 #71123
原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。