开发者

Perl IO Vs Java IO [closed]

开发者 https://www.devze.com 2023-03-13 19:47 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines guidelines. It is not currently accepting answers.
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 8 years ago.

Improve this question

I am planning to move some of our file handling components from Perl to Java.. These Perl components do operations such as

  1. adding line returns to the files.
  2. adding / removing some columns.
  3. zipping /unzipping of files.

etc.

But I am worried , as this may not perform well in terms of speed & memory.

Do we have any benchmark / comparison study for Java Vs Perl IO?

Is it good idea, to integrate Perl modules in Java (calling Perl modules from java using Apache XMLrpc, I haven't tried this yet)

Please share your thoughts / experi开发者_如何学编程ences.


In my experience, simple file manipulation such as the one that you described, are easier to do with perl rather than java. I'm not saying that java I/O performance is not good (actually I can't point you to any comparison between perl and java I/O performance). I'm just saying that perl scripts that manipulate files are usually easier and shorter to write than using java for such tasks. Also, don't forget that Perl can be read as Practical Extraction and Reporting Language ... so, manipulating files and their content is actually one of its primary usage :)

Finally, I wouldn't call Perl from java. If I'd decided to move to java, then I would re-write everything in java.


Rewriting working code should not be time wasting. Consider what you need more. Rewriting to java takes more time but makes maintaining easier/integrating with your java app. But perl is more flexible for extraction and reporting. What is the quality of perl code? If bad, rewrite in java if good why to trash so much work?

I would not afraid running perl as procesess from java. It's is very easy to interexchange data with perl from any language (pipes, command line arguments, whatever). Builtin process framework for java is enough. How often do you use perl code? (every 200ms? or from time to time?). If not very often you can just run processes. If very often I cannot estaminate overhead.


Perl is definitely more concise than Java, but from a maintenance perspective it's nice to have everything in one language, or at least major modules in one language as opposed to wrapping lots of stuff together. If the rest of the system is java, I'd definitely say rewrite the perl code in java.

Beside the maintenance perspective, you also have to think about documentation. If you are generating docs (say, javadocs) it's nice if you get the full file io functions documented as well. I suppose you could document the wrappers though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号