Tidy on 64-bit

Cory Nelson <[email protected]> Mon, 27 Jun 2005 22:43:13 -0700
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
Okay, x64 binaries (and source) are now available at
http://dev.int64.org/tidy.html

Benchmarked against the ~36MiB JMDict
(http://www.csse.monash.edu.au/~jwb/j_jmdict.html), Tidy ran a little
over 23% faster in x64.

Source was modified slightly to make it work and still has a long way
to go before it'll compile without warnings.  Output appears to be the
same between x64 and x86 and there have been no crashes.

-- 
Cory Nelson
http://www.int64.org
bench.c (text/plain, 1008 B)
#include <stdio.h>
#include <windows.h>
#include <process.h>
#include <tidy.h>

static unsigned int __stdcall benchthread(void *arg) {
	TidyDoc tdoc=tidyCreate();
	tidyOptSetBool(tdoc, TidyXmlTags, yes);
	tidyOptSetBool(tdoc, TidyXmlOut, yes);
	tidyOptSetBool(tdoc, TidyShowWarnings, no);
	tidyParseFile(tdoc, (ctmbstr)arg);
	tidyCleanAndRepair(tdoc);
	tidyRelease(tdoc);

	return 0;
}

static double GetThreadTime(HANDLE thread) {
	__int64 c, e, k, u;

	GetThreadTimes(thread, (FILETIME*)&c, (FILETIME*)&e, (FILETIME*)&k, (FILETIME*)&u);

	return u/10000000.0;
}

int main(int argc, char *argv[]) {
	int i;

	if(argc<2) {
		fprintf(stderr, "usage: %s <xml>\n", argv[0]);
		return -1;
	}

	for(i=1; i<argc; ++i) {
		double time;
		HANDLE thread=(HANDLE)_beginthreadex(NULL, 0, benchthread, argv[i], 0, NULL);

		WaitForSingleObject(thread, INFINITE);
		time=GetThreadTime(thread);
		CloseHandle(thread);

		printf("%.6f   %s\n", time, argv[i]);
	}

	return 0;
}