ocaml/opam-repository — pull request #1221 by ysulsky (2013-10-17 19:14:55+00:00)
Title: core 109.47.00-rc1

# 109.47.00

## Type_conv
- Made `type nonrec` work when a type has both an equation and a representation.

For example:

```ocaml
type t = A of t
module T = struct
type nonrec t = t = A of t
end
```

## Pa_test
- Added new syntax `<:test_result<>>`, which is similar to `<:test_eq<>>`.

`test_result` is meant for the common case of comparing some hardcoded
expected value against one returned by some code you're testing. In
this case you can now write, for example:

```ocaml
<:test_result> 3 ~expected:4
```

which behaves exactly the same way as:

```ocaml
<:test_eq> 3 4
```

except that the error message is something like:

```
("got unexpected result"
((got 3) (expected 4)
(Loc "File \"z.ml\", line 44, characters 25-25")))
```

rather than:

```
("comparison failed"
(3 vs 4
(Loc "File \"z.ml\", line 44, characters 25-25")))
```

The additional labels on the values help identify the problem earlier.

## Core_kernel
- Added `Binary_searchable.Make` functor to core, and used it in `Array` and `Dequeue`.
- Fixed `Bounded_int_table` to match `Invariant.S2`.
- Added to `Pool` support for `10-`, `11-`, and `12-` tuples.
- Added functions to the `Gc` module to get usage information without allocating.

Added these functions, all of type `unit -> int`:

```
minor_collections
major_collections
heap_words
heap_chunks
compactions
top_heap_words
```

They all satisfy:

```ocaml
Gc.f () = (Gc.quick_stat ()).Gc.Stat.f
```

They all avoid the allocation of the stat record, so one can monitor
the garbage collector without perturbing it.

## Core
- Changed `Daemon.daemonize` and `daemonize_wait` to leave the `umask` alone by default.

Previously, these had alwasy set the umask to `0`, which means that
all app-harness programs and all binaries run from grass were creating
world-writeable (`0666`) files by default.

## Async_core
- Fix a bug introduced in `Monitor.error` in 109.28, in which the error wasn't seen unless someone is listening to the monitor.

## Async_unix
- Changed `Fd_by_descr` so that it actually calls `Bounded_int_table.invariant`.

# 109.46.00

## Core_kernel
- Added `Error.to_info` and `of_info`.
- Significantly sped up `Float.iround_*` functions.

For `iround_down_exn`, the new version appears to use about 25% of the
CPU time of the old version on non-negative floats. For negative
floats it uses around 60% of the CPU time.

```
┌─────────────────────────┬───────────┬──────────┐
│ Name │ Time (ns) │ % of max │
├─────────────────────────┼───────────┼──────────┤
│ old iround_down_exn pos │ 15.02 │ 95.23 │
│ new iround_down_exn pos │ 3.75 │ 23.75 │
│ old iround_down_exn neg │ 15.78 │ 100.00 │
│ new iround_down_exn neg │ 9.80 │ 62.10 │
└─────────────────────────┴───────────┴──────────┘
```

## Core
- Added `Time_stamp_counter` module, which has fast (< 10 nanos) access to the hardware time-stamp counter.

This module provides the fast function `Time_stamp_counter.now ()`
which is our best effort high-performance cycle counter for a given
platform. For x86 systems this retrieves the CPU's internal time
stamp counter using the `RDTSC` instruction. For systems that do not
have a RDTSC instruction, we fallback to using
`clock_gettime(CLOCK_MONOTONIC)`.

Here is a benchmark of execution time in nanos and allocations in words:

```
Name Time/Run Minor
------------------------------- ---------- -------
Time.now 39.02 2.00
TSC.now 7.54
TSC.to_time 4.88 2.00
TSC.to_time (TSC.now ()) 8.54 2.00
TSC.to_time_nanos 4.49
TSC.to_time_nanos(TSC.now ()) 8.95
Calibrator.calibrate 279 34.00
```

Historically, the rate of increment of the TSC (sometimes referred to
as the TSC frequency) varied based of CPU overclocking, temperature,
load etc. On modern Intel CPU's the TSC is expected to be stable. On
Linux systems, the "constant_tsc" in `/proc/cpuinfo` indicates that the
machine has a stable TSC rate. While this module assumes that the TSC
is relatively stable, it can adapt to small variations in the TSC
frequency.

## Async_unix
- Added `Socket.Address.Inet.to_host_and_port`.

## Async_extra
- Added `with sexp` to `Log.Output.machine_readable_format` and `format`.