简体   繁体   English

改善Runtime.exec()

[英]Improve Runtime.exec()

My program connects to external code via Runtime.exec(). 我的程序通过Runtime.exec()连接到外部代码。 It is quite fast but the program really spends most time in the Runtime.exec() call (tested with profiler). 速度非常快,但是该程序实际上花费了大部分时间在Runtime.exec()调用中(已使用事件探查器进行了测试)。

At this point there is no choice for a native library, so i am stuck with the Runtime.exec() code. 在这一点上,本机库别无选择,因此我被Runtime.exec()代码所困扰。

I'm wondering if there is any way to improve the performance of the external program call from Java or even from the OS that i am not aware of. 我想知道是否有任何方法可以改善从Java甚至我不知道的OS进行的外部程序调用的性能。

Are you sure you're not measuring cumulative time - ie the exec call duration is the duration of the call itself + the time of the actual functionality you're invoking? 您确定不测量累积时间-即exec调用持续时间是调用本身的持续时间+您要调用的实际功能的时间吗?

The reason I ask is that I've always find runtime.exec to be pretty performant. 我问的原因是,我总是发现runtime.exec表现出色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM