9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] make arrays big: qsort edition
Date: Sun, 01 Aug 2021 19:53:07 -0400	[thread overview]
Message-ID: <92BC9BB66CE6AA73D2754A565F337131@eigenstate.org> (raw)
In-Reply-To: <CAH_zEu5Dy8XHu4YbhNXNg8Hoa0yz9t8YqNXtakM4GRXnyROyMw@mail.gmail.com>

Quoth Nick Owens <mischief@offblast.org>:
> are you able to test this change with a very large array?

Yes, but not easily. This is work towards
fixing that.

Here's a program that creates a large array
using brk.

#include <u.h>
#include <libc.h>

extern char end[];
usize sorted;

int
intcmp(void *a, void *b)
{
	sorted++;
	return *(int*)b-*(int*)a;
}

void
main(int argc, char **argv)
{
	usize n;
	int *p;

	n = 8ULL*1024*1024*1024;
	if(brk(end + sizeof(int)*n) == -1)
		sysfatal("brk: %r");
	p = (void*)end;
	qsort(p, n, sizeof(int), intcmp);
	fprint(2, "%zd\n", sorted);
}


  parent reply	other threads:[~2021-08-02  4:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 17:14 ori
2021-07-29 23:15 ` Nick Owens
2021-07-30 17:24   ` Steve Simon
2021-08-01 23:53   ` ori [this message]
2021-08-02 16:14     ` cinap_lenrek
2021-08-03  4:11       ` ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92BC9BB66CE6AA73D2754A565F337131@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).