view mercurial/compat.h @ 32177:8f1a2b848b52

dirstate: optimize walk() by using match.visitdir() We already have the logic for restricting directory walks in match.visitdir() that we use for treemanifests. We should take advantage of it when walking the working copy as well. This speeds up "hg st -I rootfilesin:." on the Firefox repo from 0.587s to 0.305s on warm disk (and much more on cold disk). More time is spent reading the dirstate than walking the working copy after. I tried to find scenarios where calling match.visitdir() would be a noticeable overhead, but I couldn't find any. I encourage the reader to try for themselves, since this is performance-critical code.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 05 May 2017 08:49:46 -0700
parents 7b22599dcb85
children f4433f2713d0
line wrap: on
line source

#ifndef _HG_COMPAT_H_
#define _HG_COMPAT_H_

#ifdef _WIN32
#ifdef _MSC_VER
/* msvc 6.0 has problems */
#define inline __inline
#if defined(_WIN64)
typedef __int64 ssize_t;
#else
typedef int ssize_t;
#endif
typedef signed char int8_t;
typedef short int16_t;
typedef long int32_t;
typedef __int64 int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#else
/* not windows */
#include <sys/types.h>
#if defined __BEOS__ && !defined __HAIKU__
#include <ByteOrder.h>
#else
#include <arpa/inet.h>
#endif
#include <inttypes.h>
#endif

#if defined __hpux || defined __SUNPRO_C || defined _AIX
#define inline
#endif

#ifdef __linux
#define inline __inline
#endif

#endif