Does an AWK script take up a lot of CPU?

2019-08-18 02:01发布

Does AWK uses a lot of processing power? If so, is there a better scripting language to do it? Or should I do it in C itself (where rest of my code is).

2条回答
不美不萌又怎样
2楼-- · 2019-08-18 02:34

If most of your code is in c, It is probably cleaner to use c to do your string processing rather than shelling out.

You can use PCRE directly in your program.

查看更多
看我几分像从前
3楼-- · 2019-08-18 02:46

Depends on what you're telling it to do. Most of the work is passed to the regexp engine, which should be similar, no matter what language you use.

Now if you're using an awk script from inside a C program, and you have the resources to just implement the functionality in C too, you're best off doing that. You'll avoid the process creation/termination + communication overhead (which may or may not be a big part of the performance hit you'll get).

For more information, tell us more about your script!

查看更多
登录 后发表回答