--Hi all,
is asort() function exist in TAWK (or only in gawk) ?
thx
--Hi all,
is asort() function exist in TAWK (or only in gawk) ?
In article <b0a1d496-2fb2-4e79...@googlegroups.com>,I expressed badly myself, I wanted to know if there is a function similar to asort(gawk) in TAWK ?
Laurent MANCHON <manch...@gmail.com> wrote:
--Hi all,
is asort() function exist in TAWK (or only in gawk) ?Not in TAWK, but not really needed (see below).
However, I'm wondering what the point of the question is. Either you have access to TAWK - in which case you would know and/or could quickly
determine the answer to the question - or you don't - in which case, the question is moot. So, which is it?
Anyway, I don't really see the point of asort(), once you have regular
array sorting (see footnote: *) - which TAWK has always had, and GAWK now has. GAWK's implementation of array sorting is actually quite nice - in fact, more elaborate and powerful than TAWK's. My sense of the GAWK development effort is that they put asort()/asorti() in at a point in the development when they realized that some sort of array sorting was needed, but they weren't quite ready to do full/regular array sorting.
So, I think asort()/asorti() is now retained mostly for historical reasons.
(*) By "regular" (or "full") array sorting, I mean via the "for (i in A) ..."
syntax.
--
Never, ever, ever forget that "Both sides do it" is strictly a Republican meme.
It is always the side that sucks that insists on saying "Well, you suck, too".
I expressed badly myself, I wanted to know if there is a function similar to asort(gawk) in TAWK ?
As I have to calculate medians I have to sort the values of the table in increasing order and then compute medians on it.
Hence the need for the asort function. I know I can write my own sort function such as:
function alength(A, n, val) {
n=0;
for (val in A) n++
return n;
}
function masort(A, hold, i, j, n) {
n = alength(A);
for (i = 2; i <= n ; i++) {
hold = A[j = i];
while (A[j-1] > hold) {
j--;
A[j+1] = A[j];
}
A[j] = hold;
}
delete A[0];
return n;
}
But I think that an embedded function is faster than a function created in the header, don't you ?
For exemple in Tawk if i want to compute the length of an array i think *_arr is faster than alength(_arr)
I expressed badly myself, I wanted to know if there is a function similar to >asort(gawk) in TAWK ?
As I have to calculate medians I have to sort the values of the table
in increasing order and then compute medians on it.
On Wednesday, 11 August 2021 at 13:02:23 UTC-4, Ed Morton wrote:
Sure but why bother trying to find the equivalent of a gawk function in
tawk (available by word of mouth from individuals with a copy of it,
with people mailing photocopies of documentation to each other and a
small user base) instead of just using gawk (widely/easily available, thoroughly documented online and in books, with a massive user base)?
Ed.
on unix machine i don't like gawk i prefer mawk which is faster than gawk.
and on windows, compiled program with Tawk v6.7 are faster than gawk.
On 12.08.2021 09:02, Laurent MANCHON wrote:
on unix machine i don't like gawk i prefer mawk which is faster than gawk.
Is that true? - I know of some performance tests (done by Andrew Sumner
20+ years ago) where that was actually not the case - some test cases
were faster, some slower -, and since then a lot of optimizations have
been done in GNU Awk (including byte code support).
and on windows, compiled program with Tawk v6.7 are faster than gawk.
If speed is a critical issue you may also try awka, an Awk compiler.
on unix machine i don't like gawk i prefer mawk which is faster than gawk. >and on windows, compiled program with Tawk v6.7 are faster than gawk.
I think Awka has been discontinued for a long time now (http://awka.sourceforge.net/download.html),
and not sure if it works with the latest versions of gcc.
In article <sf2ide$ab7$1@news-1.m-online.net>,
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
On 12.08.2021 09:02, Laurent MANCHON wrote:
and on windows, compiled program with Tawk v6.7 are faster than gawk.
1) It is unlikely that speed really is an issue. Most people who think it
is (in pretty much all contexts), turn out to be misguided. If you want efficiency, writing in AWK is probably not what you should be doing in the first place.
If speed is a critical issue you may also try awka, an Awk compiler.
I don't think awka - or any other so-called "awk compiler" - makes any
claims to making your program run faster. Aren't they all just for encryption (aka, code security) purposes?
BTW, all this talk by you and your c.l.a friend which are of the strain
"Why don't you just use GAWK like we do?" are misguided.
You have some misconception here; the two persons who suggested GNU Awk
in this thread were Ed and you.
[ please quote context if posting in Usenet ]
On 12.08.2021 10:10, Laurent MANCHON wrote:
I think Awka has been discontinued for a long time now >(http://awka.sourceforge.net/download.html),
and not sure if it works with the latest versions of gcc.
It's discontinued, yes. (And I haven't tried to compile it with
the latest gcc.)
But isn't Tawk - that you use on Windows - also discontinued?
(So I've heard, at least, since many years.)
--
i don't work with very long lines, but i work with very big text files with million of rows.
In in my opinion the main drawback of all awk's family is the string concatenation, it takes too much time,
and this is what I have noted.
Maybe it's common to all languages, I don't know how C handles it.
--
i don't work with very long lines, but i work with very big text files with million of rows.
In in my opinion the main drawback of all awk's family is the string concatenation, it takes too much time,
and this is what I have noted.
Maybe it's common to all languages, I don't know how C handles it.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 286 |
Nodes: | 16 (2 / 14) |
Uptime: | 83:12:31 |
Calls: | 6,495 |
Calls today: | 6 |
Files: | 12,096 |
Messages: | 5,276,829 |