3 ms·
> This is incoherent no matter what two programming languages you are talking about. Yet everyone talks about performance when it comes to programming language
by johnisgood 1y ago
> This is incoherent no matter what two programming languages you are talking about.
Yet everyone talks about performance when it comes to programming languages. Why? And what does coherence have anything to do with it?
Plus I explained what I meant by that, there is a huge difference in the startup time of Perl and Python, for one, and you can check benchmarks. The implementation of the two languages are not identical. If they are not identical, there must be a difference in performance one way or another, I assume.
> This is incoherent no matter what programming language you are talking about. Of course it's a matter of opinion. Other people aren't going to like the same syntax you do.
I do not think anyone is going to argue that Brainfuck was made with easy string manipulation in mind, or Forth.
The point is that Perl helps you manipulate strings with relative ease. Assuming you know the language, yeah.
In fact, please read other comments, because I have already said this: "For the 100th time, I was responding to "[...] python and it is easy to do string manipulation with.".". It is easy to do so in Python, but even easier (and faster) to do on Perl. In both cases there is an assumption of knowing the language, and I thought that goes without saying.
I said nothing about liking the syntax or whatever you are trying to read into it. It is easy to do string manipulation, regardless of your like or dislike of the syntax. Thus, not an opinion.
- exe34 1y agoOh you're still here, I thought you were done 5 times already. All I said was "it is easy to do string manipulation with", not it's the absolute best thing ever and the fastest at everything!
- johnisgood 1y agoYeah, you are everywhere, too. I am done talking to you, however, so this was the last response you have gotten from me. Have fun reading https://news.ycombinator.com/item?id=44359539 https://news.ycombinator.com/item?id=44359539.
- exe34 1y agoI don't come here for the essays about things I'm not interested in, thanks!
- johnisgood 1y agoSo you were not interested in it at all, all you wanted to express was a "You are wrong, I'm right, kthxbai"? Cool, another reason to avoid you. :D
- exe34 1y agoWhat exactly did I say that was wrong?
- johnisgood 1y agoThat quote was directed at me, by you. :P If you are interested in why I claimed what I claimed, you would read my reasoning. If you are not interested, that is fair enough, too. It does not matter much in particular.
- exe34 1y agoYes, what I wrote was "Presumably because the author is comfortable with python and it is easy to do string manipulation with." I'm still not sure why this got you so involved.
- johnisgood 1y agoIt is not that specific comment that got me involved. As I have said a couple of times, it is fair enough that he is comfortable with Python or that he decided to use it for whatever reasons. At any rate, I cannot come back to this thread anymore. :P
- exe34 1y ago
- zahlman 1y ago> Yet everyone talks about performance when it comes to programming languages. Why? I know this may come as a shock to the average HN reader, but most people do not think very clearly. Even programmers. And among those who do, it is quite rare that people speak precisely without putting in considerable effort. > but even easier (and faster) to do on Perl. You have no objective way to substantiate this claim (because such cannot exist), therefore it is in fact a matter of opinion.
- johnisgood 1y agoOh but there is an objective way to substantiate this claim. How familiar are you with Perl? It will not work (to convince you) if you do not know the language, you need to be quite familiar with it. There are extremely short ways to do string manipulation, for one, think 3 characters short. So, assuming you know Perl, it is definitely easier AND faster, than say, Python. Trivial example: Replace all numbers in a string (faster and easier in Perl): Perl: $string =~ s/\d+/NUM/g; Python: import re string = re.sub(r'\d+', 'NUM', string) Perl's design history is text processing as a first-class goal. It has syntax-level efficiency, and expressive power (e.g. s///e, tr///, inline regex flags, etc.). Do you want me to go on? These are all objective ways to substantiate the claims I made. Perl is implemented in C with a runtime that aggressively optimizes text processing. The core primitives such as split, join, substr, index, s///, etc. are tight wrappers around C functions with minimal object overhead. In Python, even simple string manipulations go through Python's object system, and in Python strings are immutable, so every manipulation creates a new string object, which incurs extra memory allocation and garbage collection. Perl is typically 30-80% faster in similar regex-heavy workloads because there is no import overhead, there is internal opcode dispatch for regex, and no allocation of new strings until match is confirmed. Additionally, Perl frequently wins by eliminating boilerplate, as shown above. It has advanced features with simple syntax, too, meaning you get fewer lines of code, fewer concepts to juggle, and faster iteration time. Python, by contrast, forces the developer to switch between the re module for non-trivial regex, multiple string method calls, and so forth. Shall I go on? I can objectively substantiate my claims with regarding to Perl vs. Python, as I have done above, but if it is not enough for you, I could easily go on. I can give you benchmarks, too, if you so wish. FWIW, my claim was: you can achieve string manipulation / text processing faster (both execution speed and development time) and easier in Perl vs. Python. --- The bottom line is, that for text-heavy workloads, Perl remains the more efficient and developer-friendly tool as opposed to Python; a conclusion that can be quantified, measured and defended objectively. It is not an opinion, nor a matter of taste. Just to reiterate, across a wide range of text processing tasks, Perl consistently offers: - Fewer lines of code - More powerful and concise idioms - Better CLI support - Faster execution for regex-heavy operations - Less boilerplate and setup overhead This list is non-exhaustive, and I can get more into the implementation details (I did touch it above), too, if you so wish, such as, for example, how Perl's interpreter is string-first and how Perl uses SVs that are internally optimized to handle both numbers and strings interchangeably without conversion overhead, as opposed to Python that uses PyObject-based immutable strings which incur copy-on-write penalties and method dispatch overhead.