5 ms·
It doesn't. Use C#, Java, or even python. If you're low level and dealing with low level code and constructs, you're better off using C, or C++ just for the lan
by maldev 4y ago
It doesn't. Use C#, Java, or even python. If you're low level and dealing with low level code and constructs, you're better off using C, or C++ just for the language features like templates.
Rust is genuinely only useful for the niche application of a desktop application, that doesn't reach low level, but you need a bit more fine grain controls than C# or another higher level language will allow. For example, a web browser is like the ideal usecase for Rust, and it makes sense, since that's really where it's got most of it's teeth with Mozilla.
I personally don't see why you would do something like Grep, in Rust, when C#, Python, Go, exist. But I do see like Unreal Engine or again, Firefox/webbrowser in Rust being nice.
- alephu5 4y agoGrep is a performance sensitive program, it's not unusual to scan through thousands of files and millions of lines so small inefficiencies are noticeable. If you tried this in python it would probably take hours to scan through something that ripgrep does in a few seconds
- burntsushi 4y agoPeople have written greps in Go and Python (and Perl), and they aren't even close in all around perf to GNU grep (written in C) or ripgrep (which I wrote in Rust). Maybe you don't know what you're talking about, despite coming across as certain of yourself.
- maldev 4y agoI'll write a simple grep tool right now in C# then and see what performance I can get. I'll get back to you when I finish.
- burntsushi 4y agoHere are your benchmarks to try: https://blog.burntsushi.net/ripgrep/ https://blog.burntsushi.net/ripgrep/ If you respond, please provide instructions to reproduce your measurements for a Linux machine. Why do you even have to write one in the first place? If C# is such a natural choice, why hasn't it already been done?
- maldev 4y agoPowershell actually ships one! I think you have a good point. I was going to build my own as C# ships alot of configuration options that can DRASTICALLY improve speed, which arn't on by default. But, we can test Redmonds version and get at least a decent idea of if it's suitable. I'll run some tests on that and get back to you in an hour or so. I'll use the same tests you have on https://github.com/BurntSushi/ripgrep/blob/master/benchsuite/runs/2016-09-20-ubuntu1604-ec2/raw.csv https://github.com/BurntSushi/ripgrep/blob/master/benchsuite... My testing will be on my Dev VM, in a WSL container on ubuntu 22.04, targeting a built linux kernel. With powershell from the Microsoft blobs they ship for linux. And Ripgrep from just Apt Install Ripgrep. With 5 warmup cycles for each.
- burntsushi 4y agoPlease be sure to read my blog post that I linked very carefully. Benchmarking greps is rather difficult and quite subtle. Are you talking about findstr? If so, I'm not sure that's available on Linux. So it doesn't seem like a viable grep to me. If the program you want to be a grep only runs on Windows, then that isn't really viable. Also, Windows file system operations tend to be quite a bit slower than Linux. Also, where is the source for findstr?
- maldev 4y agoAlright, so initial testing result. I'm not going to even bother putting into excel, RipGrep blew the hell out of Powershells built in stuff. Like, we're talking exponentially quicker, so well done. (3 minutes for Pwsh vs 2 seconds Ripgrep) But I don't think it's the fault of C# and I think it's the fault of some poor coding on redmonds side, and very good coding on your side. And since I have to make up 12 hours tomorrow at work, but have zero tickets. I'll probably go in and write a Grep utility in C# and I think I can get similar speed to the Rust implementation. C# is also cross platform as of a couple years ago, as well as is powershell. So my testing was running Powershell on linux against the newest linux kernel source code + the build artifacts.
- 4y ago