CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: C++ vs Perl

  1. #1
    Join Date
    May 2009
    Posts
    41

    C++ vs Perl

    Hi,

    When dealing with big text files and large directories of files that you need to search / parse, I was wondering if anyone knows how much faster C++ is than Perl approximately? Is it worth it to develop in C++ over Perl in these cases?

    FRo

  2. #2
    Join Date
    Nov 2006
    Posts
    1,611

    Re: C++ vs Perl

    Perhaps not.

    It would depend on the target machine to some degree, but in modern hardware (this side of a single core 1Ghz chip), a C++ version would probably leave the CPU so idle, depending on what you mean by parsing, that the bottleneck is likely the read speed and random access time of the file system.

    That said, if the parsing is demanding then that portion of a C++ version would be more efficient and possibly faster. Without more detail as to what you're parsing and doing with the results, I can't be more specific.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  3. #3
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401

    Re: C++ vs Perl

    My experience is that C++ is 2-10 times faster.

    However, my experience is based on data processing, where the files were read and written using an API (which was written in C). And as a matter of fact, in this scenario the opposite of what JVene posted was true: The lighter the processing the more significant the difference was (due to the fact that the penalty for reading a file via a C API became bigger when the actual processing was lighter). I don't think, the above will hold true though for processing where the file is read/written using the language's native functions.
    More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf

    Premature optimization is the root of all evil --Donald E. Knuth


    Please read Information on posting before posting, especially the info on using [code] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured