简体   繁体   中英

Improve Runtime.exec()

My program connects to external code via Runtime.exec(). It is quite fast but the program really spends most time in the Runtime.exec() call (tested with profiler).

At this point there is no choice for a native library, so i am stuck with the Runtime.exec() code.

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.

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?

The reason I ask is that I've always find runtime.exec to be pretty performant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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