TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Frawk: A fast, JITted, statically-typed AWK written in Rust

145 点作者 benhoyt超过 3 年前

12 条评论

asicsp超过 3 年前
I tried this last year when I started writing a book with Rust cli tools like ripgrep, hck, sd, huniq, etc. Was impressed with the performance. Found a few syntax issues when I simply tried to run gawk one-liners I had with frawk and they were fixed by the author. Hope the project crosses version 1.0 soon.
评论 #30345992 未加载
htfy96超过 3 年前
One of my recent project requires a fast awk implementation, and I tried frawk and got surprised by how robust it is. Although eventually we chose <a href="https:&#x2F;&#x2F;github.com&#x2F;noyesno&#x2F;awka" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;noyesno&#x2F;awka</a> for better native awk script compatibility, it&#x27;s still wonderful to see a project incorporating recent advances of programming language implementation into the ancient awk.
ogogmad超过 3 年前
Note: You can do many of these one-liners using tools that understand Python: Xonsh or Pyp. You won&#x27;t need to learn Awk -- let alone any non-standard dialect of Awk. It won&#x27;t be as fast as some Awk implementations (maybe), but you&#x27;ll have a gentle on-ramp and off-ramp to a more featureful programming language.<p>I think the problem with DSLs is when a problem only partially fits into what they can do.
评论 #30346492 未加载
评论 #30346069 未加载
评论 #30357185 未加载
dontlaugh超过 3 年前
Interesting (and a bit surprising) that the cranelift backend keeps up with LLVM backend reasonably well, especially with parallelism enabled <a href="https:&#x2F;&#x2F;github.com&#x2F;ezrosent&#x2F;frawk&#x2F;blob&#x2F;master&#x2F;info&#x2F;performance.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ezrosent&#x2F;frawk&#x2F;blob&#x2F;master&#x2F;info&#x2F;performan...</a>
mkdirp超过 3 年前
There is also goAWK[0], a re-implementation of AWK in Go.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;benhoyt&#x2F;goawk" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;benhoyt&#x2F;goawk</a>
评论 #30345093 未加载
yjftsjthsd-h超过 3 年前
Drat:<p>&gt; To a first approximation, it is an implementation of the AWK language; many common Awk programs produce equivalent output when passed to frawk.<p>So it sounds like it&#x27;s (intentionally) not a drop in replacement. That&#x27;s probably reasonable in context but unfortunate in terms of making adoption harder.
评论 #30343998 未加载
评论 #30344006 未加载
pepproni超过 3 年前
In the example I noticed a PREPARE block in addition to the well known BEGIN and END blocks. After a few minutes of searching it appears to be frawk specific:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ezrosent&#x2F;frawk&#x2F;blob&#x2F;master&#x2F;info&#x2F;parallelism.md#aggregations" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ezrosent&#x2F;frawk&#x2F;blob&#x2F;master&#x2F;info&#x2F;paralleli...</a><p>&quot;Because the repeated map references are both annoying to write and inefficient to execute, frawk has a PREPARE block which executes in the worker threads at the end of its input&quot;
scandox超过 3 年前
&gt; You will need to install Rust<p>Am I right in saying Rust can produce executables that can be run without any Rust runtime etc being on the target system? Why would you need to install Rust in cases like this?
评论 #30345272 未加载
评论 #30344641 未加载
评论 #30344462 未加载
frafra超过 3 年前
&gt; Lack of support for structured CSV input data.<p>Alternative approach that can be used sometimes: use TSV (tab-separated values), which make parsing trivial and works great with a wide range of tools; conversion from CSV to TSV can be done with csvkit or similar.
prirun超过 3 年前
There&#x27;s also this for the Python fans:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;alecthomas&#x2F;pawk" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;alecthomas&#x2F;pawk</a>
hawski超过 3 年前
A bit offtopic, but has someone implemented a structured regex awk? I&#x27;m constantly hoping it will become a thing.
jhallenworld超过 3 年前
Neat tool! I like this is as a small example of SSA-based dataflow analysis.