Skip site navigation (1) Skip section navigation (2)

Re: AW: [HACKERS] varchar() vs char16 performance

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: andreas(dot)zeugswetter(at)telecom(dot)at, pgsql-hackers(at)hub(dot)org
Subject: Re: AW: [HACKERS] varchar() vs char16 performance
Date: 1998-03-19 19:50:11
Message-ID: 199803191950.OAA14676@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> I don't really see this as a big deal since, for example, only 16 bytes
> are allocated for a char16, so it is not guaranteed to be zero delimited
> and you have to make a working copy to use libc functions anyway. Also,
> that is really an implementation detail or annoyance rather than a
> user-visible feature.

Agreed.

> With the macros that are provided for the varlena structure
> manipulations, things are pretty convenient. Are there more macros which
> could be helpful here??

>From postgres.h:
	
	#define VARSIZE(PTR)    (((struct varlena *)(PTR))->vl_len)
	#define VARDATA(PTR)    (((struct varlena *)(PTR))->vl_dat)
	#define VARHDRSZ        sizeof(int32)

I have gone throught the code before 6.3, and changed many hard-coded
4's to use these macros.
-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-03-19 19:57:13
Subject: Re: AW: [HACKERS] varchar() vs char16 performance
Previous:From: Bruce MomjianDate: 1998-03-19 19:47:10
Subject: Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group