|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 22/28] libxl: ocaml: event management
On 25/03/13 14:45, Rob Hoes wrote: The OCaml manual[*] (S19.7.2) hints that the name lookup is a bit slow:"The pointer returned by caml_named_value is constant and can safely be cached in a C variable to avoid repeated name lookups. On the other hand, the value pointed to can change during garbage collection and must always be recomputed at the point of use."
The manual suggests caching the value * in a static like this:
void fd_deregister(void *user, int fd, void *for_app_registration)
{
CAMLparam0();
CAMLlocalN(args, 2);
static value * func = NULL;
if (func == NULL) {
/* First time around, look up by name */
func = caml_named_value("fd_deregister");
}
...
[*] http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |