package core
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7e24955289ada4c23029b468bac6a4ebfc5957867c3ab5ced64027cb8bf67569
md5=cf90a82584ec5cdc6d8b412a4067b6f6
CHANGES.md.html
113.43.00
Time.Ofday.of_string
supports "AM and "PM" suffixes.Change the innards of
Command.Flag
so it no longer uses mutable state. It now updates aUniv_map.t
instead.Renamed:
core/test --> core/test-bin
since these directories contain executables to run rather than libraries with standard unit tests. This is in preparation for moving the standard unit tests to a more "normal" test directory.
Move unit tests from core/src to core/test .
The output for the "version" subcommand and the "-version" flag is now the same.
Core.Std.Lock_file doesn't work properly on OSX, see this:
https://github.com/janestreet/jenga/issues/4#issuecomment-205176593
This fix the issue by requiring both flock and lockf only on Linux.
Closes janestreet/jenga#4
Unix.fork_exec needs to handle exceptions raised by exec
Remove
Core.Core_list
, which was not inCore.Std
and had only an unusedto_sequence
.Array.random_element
Shift operations are unspecified outside of the range
0 <= x < bitsize
.This fixes unit tests for core/src/core_unix.ml in 32bit.
Replace all occurences (in Core) of
Time_ns.Span.to_int_ns
andTime_ns.to_int_ns_since_epoch
with their 63bit counterpart.Time_ns.Span.to_int_ns
andTime_ns.to_int_ns_since_epoch
are not implemented in 32bit.The is one step toward have unit tests to pass in 32bit.
Wrap Unix.strptime in Date and Time
New arg types in Command.Param:
sexp = Arg_type.create Sexp.of_string
sexp_conv a_of_sexp = Arg_type.create (fun s -> a_of_sexp (Sexp.of_string s))
Time_ns.Ofday.create
presently makes 2 function calls tocaml_int_compare
. Changed to use the native int comparisons and avoid the calls increate
(and other comparisons).
113.33.01
Fix build problem on BSD related to
endian.h
.
113.33.00
Updated to follow core_kernel's evolution.
Add variance annotations to a few types in
Command
.Command.Param.choice
represents a sum type.Added
Command.Spec.of_param
for conversion from new-style to old style command line specifications. This is expected to be useful for gradually converting Spec-based commands into Param-based ones.flag_names
andanon_names
gives the flags and anons used by a Command.Param.t, whilemnemonic
combines them to give a string that's good for referring to that param in error messages.This feature improves the interface of
Command.Param.one_of
by saving the caller from passing the flag names separately.Remove the closure allocation from
Date0.create_exn
Many apps take schedules as command line parameters (to determine when they'll be up, or when they should raise issues, etc.). Let's add a Schedule.Stable.V4.flag function to generate the command line param to make writing this common pattern easier.
Add Ofday.Option to
time_ns.ml
.Exports
Time_ns.Span.Option.unchecked_value
and.Ofday.Option.unchecked_value
!Finally fix
Time_ns.Of_day.of_local_time
w.r.t. DST transitions after regression test failures at the DST transition.As a result, clarified slightly the role of
Time_ns.Ofday
, likeTime.Ofday
, as 24h wall-clock times, not linear time offsets, which latter would have to be up to 25h for DST.Adds
Command.Spec.Arg_type.percent
.Add
Stable.V1
toTime_ns.Ofday.Option.t
, add it toCore.Stable
, and standardize the interface toOption
modules inTime_ns
.Add
Time_ns.to_ofday
.
113.24.02
Deprecated core.syntax and updated
coretop
to useppx_jane
113.24.01
Updated corebuild to use ppx-jane instead of camlp4
Closes #70
113.24.00
N.B. Some interface change were made which are not listed here, as they are only cascading from core_kernel
. Look at core_kernel's CHANGES.md file to get a complete history of the changes made for this release.
Add
Core.Command.Arg_type.Export.time_zone
Fix
Command.shape
to run external programs only once to get their sexp.Introduces a new variant of Command.t called Proxy. The Exec variant represents the top-level command of an external executable that has not yet been run; the Proxy variant represents an arbitrary subcommand that has been extracted by running an external executable. Command.exec constructs an Exec variant; Command.shape of an Exec variant runs the executable and generates a tree of Proxy variants representing all the information from the generated sexp, so the executable will not need to be re-run.
A version of recvmmsg that pre-allocates and reuses the iovec record. Profiling indicates this is a non-trivial amount of our I/O loop (under very heavy load).
Since nobody is using the heavyweight features of the existing recvmmsg, replace it with the lightweight one. This leads to minor but important changes to the interfaces of
Iobuf.recvmmsg_assume_fd_nonblocking
andUdp.recvmmsg_loop
.Switch to ppx.
Time.set_sexp_zone
affectst_of_sexp
If we're willing to read sexps without zones, we should be willing to let you control what timezone they're read with.
Sped up
Llimiter
.Make
Interval.Int
implementContainer
andBinary_searchable
.Add
Identifiable.S
toUnix.Cidr
so that it supports hash tables. UpdateUnix.Cidr.t
to normalize values, e.g. "192.168.1.101/24" ==> "192.168.1.0/24".Added "noalloc" attribute to
Linux_ext.unsafe_timerfd_settime
.In Iobuf, made some functions take:
(
> write
, _) Iobuf.trather than:
(read_write, _) Iobuf.t
if they only need to write to the iobuf and don't need to read it.
Time.of_string_abs
didn't support ISO 8601 time zone strings without colons, or those specified as locations. This version adds support for time zones without colonsUnix.Passwd.getpwents
takes the lock, partially appliesExn.protect
, then releases the lock, then completes the application and actually runs stuff.Command.file-completion
Files are now completed correctly when paths contain a directory.
Previously, completion when pointed at a directory would put a space at the end. This would cause the user to hit backspace every time a directory was in the path.
Add
diff_weekdays
anddiff_weekend_days
functions to date module.Time.to_date_ofday_precise
implements a complete inverse forof_date_ofday
. This is needed to give the DWIM-est semantics to Schedule.t that we can think of.Reduce allocation in Linux_ext.Epoll
Add
Time_ns.Of_day.(add_exn, sub_exn, diff)
.Adding
head_padded_fixed_string
to Iobuf.Move
Core_extended.Std.Sys.home
toCore.Std.Sys.home_directory
.Add
Iobuf.{read,write,input,output}
akin to the bigstring versions.Add expert iobuf functions for extracting bigstrings and iovecs that share the iobuf's underlying storage.
Add stable
Int63.t
conversions for types inTime_ns
.Rename DNS-based
Inet_addr
sexp conversions to expose their blocking nature.Add
Unix.Inet_addr.Stable
.Add [Core.Std.Schedule].
Fixed
Iobuf_packet.iter
, which behaved incorrectly if the packet didn't start at the lo_min of the iobuf. It usedIobuf.rewind
when it should have usedIobuf.Lo_bound.restore
.Added
@@deriving compare
toIobuf.Bound
.Add ability to
Time.format
for a specific time zoneMake more information available via Command.Shape.t
Expose machine-readable info on anonymous arguments.
Remove unnecessary rebinding of
(^/)
incore_filename.ml
. It had one call site and wasn't exposed. The(^/)
everyone uses comes from std.mlAdd
getifaddrs
toCore.Std.Unix
.Handles Packet (for interfaces that do not have an address on Linux systems only), IPv4 and IPv6 address families.
Implement
Time_ns.Span.to_string_hum
by analogy toTime.Span.to_string_hum
. The code and tests are essentially copied from "lib/core/src/span.ml".Remove our stubs for
Unix.stat
.They were upstreamed in 4.02.2.
112.35.00
Tweaked
Unix.stat
's C code to reduce float rounding error, by using double-precision rather than single-precision floats.Following Xavier's comment: http://caml.inria.fr/mantis/view.php?id=6285
Added
Date.O
module.In
Interval
, exposedcompare
in stable types by having the appropriate modules match theStable
signature.Added
Iobuf.Fill.decimal
andPoke.decimal
, for efficiently writing integers in decimal format.Removed
Filename.O
(and/^
), since it's not used that much, and is inconsistent with the older operator for this that's exposed inCore.Std
:^/
.Improved
Command
autocompletion to work even if some arguments can't be parsed.This is useful because the completion mode does not get fed precisely the same arguments that it would get if you hit RETURN.
As a simple example, if completion is set up for
my-exe
which takes a sexp as its first argument, then:my-exe '(a b)' <TAB>
will run
my-exe
in completion mode with:'(a b)'
as its first argument, rather than:
(a b)
as would be passed if RETURN had been pressed instead. Since
Sexp.of_string "'(a b)'"
fails, in this example tab completion won't work.Changed the internals a bit to make this possible. Most notably, the
Parser
module is now applicative rather than monadic, which required only a few simple changes to support.Made
Time_ns.to_time
andTime_ns.Span.to_span
round to the nearest microsecond in all cases.Previously,
Time_ns.Span.to_span
sometimes rounded incorrectly for negative spans.Added
Time.Zone.prev_clock_shift
, the analog ofnext_clock_shift
.val prev_clock_shift : t -> before:Time_internal.T.t -> (Time_internal.T.t * Span.t) option
Implemented
next_clock_shift
andprev_clock_shift
usingArray.binary_search_segmented
.Added
Lock_file.get_pid : string -> Pid.t option
.Added
val random: unit -> int
toTime_ns
andTime_ns.Span
.Renamed
Iobuf.sub
asIobuf.sub_shared
.This more closely matches
Bigstring
, and clarifies the semantics ofIobuf.sub
vssub
inBlit_intf.S
.Added
Iobuf
blit modules:Blit
,Blit_consume
,Blit_fill
,Blit_consume_and_fill
.Added
Piecewise_linear.first_knot
andlast_knot
.val first_knot : t -> (key * value) option val last_knot : t -> (key * value) option
Made
Unix.Cidr
matchComparable.S_binable
, and addedCidr.create
andCidr.netmask_of_bits
.Moved
Unix.tm
andUnix.strftime
fromCore_kernel
toCore
.Made
Crc.crc32
returnInt63.t
rather thanint64
, and addedCrc.bigstring_crc32
andIobuf.crc32
.Cleaned up old cruft in the C stubs for CRC checking.
Added
Iobuf.narrow_lo
andnarrow_hi
, which compriseIobuf.narrow
.Changed
Linux_ext.Timerfd
,Epoll.wait
, andUnix.select
to use (int
)Time_ns
rather than (float
)Time
.This avoids spurious float conversions and rounding problems.
Made all timeouts consistently treat negative timeouts as "timeout immediately".
This fixes an incorrect behavior of
Linux_ext.Timerfd.set_after
andset
, which had been rounding to the nearest microsecond, which was particularly bad for time spans smaller than 500ns, which would be rounded to zero, and then would cause the timerfd to never fire. Now, the small span is directly fed totimerfd_settime
. We also changed a span of zero to be treated as1ns
, to avoid the behavior oftimerfd_settime 0
, which causes the timerfd to be cleared and never fire.Made
Or_error
matchApplicative.S
.Added
Command.Param
, with the intention of one day replacingCommand.Spec
and providing an applicative interface for command-line parsing.This change required lots of rearrangement of
command.mli
so thatCommand.Param
andCommand.Spec
could share large portions of their interface. As a side effect, the interface is more sweeksy than before.Added
Command.shape
, for exposing the shape of a command, including what subcommands its has.Changed
Syscall_result.to_result
to return a preallocated object, and changed many uses to take advantage of this property.Pattern matching on results is much clearer than if-analysis and avoids double-checking errors in many cases.
Syscall_result.to_result
can only return preallocated results for a fewOk
values fromSyscall_result.Int
, of course, and likewise for other largeok_value
types. We have initially, and arbitrarily, limited preallocation to 64errno
's and 2048ok_value
's.Added
Sys.big_endian : bool
, fromCaml.Sys
.Disabled unit tests in
Time_ns
that started failing around 10:40pm NYC 2015-05-15.The tests indicate an off-by-one-microsecond error in round tripping between
Time.Span.t
andTime_ns.Span.t
.
112.24.00
Renamed
Dequeue
asDeque
.Added
Fdeque
, a functional deque (a double-endedFqueue
, or a functionalDeque
).Changed
Fqueue
's bin-io format, and added a stable type.Deprecated deque-like functions in favor of
Fdeque
.Added
Fheap
, a functional heap implementation based on pairing heaps.Reverted the change to
Or_error
's bin-io format made in 112.17, going back to the format in 112.16 and before.Added to
Unix.env
type a ``Replace_rawvariant, as used in
execand
fork_exec`.Added
Array.Permissioned
module, which has a permissioned array type and permissioned versions of all the regular array functions.Added
Date.week_number : t -> int
.Added values to
Day_of_week
:of_int_exn
,iso_8601_weekday_number
,weekdays
.val of_int_exn : int -> t val iso_8601_weekday_number : t -> int val weekdays : t list (- [ Mon; Tue; Wed; Thu; Fri ] *)
Switched
Float
IEEE functions to useInt63.t
for the mantissa rather thanint
, so they work on 32-bit platforms.Added a
length
field to theMap.t
record, makingMap.length
O(1)
rather thanO(n)
.Moved a fragment of
Time_ns
fromCore
toCore_kernel
, enough so thatAsync_kernel
can useCore_kernel.Time_ns
and ultimately only depend onCore_kernel
.Fixed compilation of
Time_ns
32-bit Linux.Added
Bounded_int_table.clear
.Fixed the
module_name
passed toIdentifiable.Make
for a number of modules.The module name must be an absolute module path.
Reported here: https://github.com/janestreet/core/issues/52
Added
Tuple.Binable
functor, for making binable tuples.Sped up a
Time_stamp_counter
unit test.Time_stamp_counter
unit test has an 18s unit test, which seems excessive. Take a couple of orders of magnitude off the number of iterations.Added
Time_ns.pause
, whose implementation is the same asTime.pause
.This involved moving the
nanosleep
C code fromCore
toCore_kernel
.This was necessary so that
Async_kernel
can pause without introducing a dependence of Async on Core.Made
Core_kernel.Time_ns.Alternate_sexp
use a similar format toCore.Time_ns
.This was needed so that
Async_kernel
can use a nice sexp format for time spans.Changed
Timing_wheel
implementation to useTime_ns
, and moved toCore_kernel.Timing_wheel_ns
; madeCore.Timing_wheel
a wrapper aroundTiming_wheel_ns
.Generalized the timing-wheel interface to be parametric in
Time
, so that one interface applies to bothTiming_wheel
andTiming_wheel_ns
.Generalized the timing-wheel unit tests to a functor,
Timing_wheel_unit_tests.Make
, that is used to test bothTiming_wheel_ns
andTiming_wheel_float
. Moved a few tests that depend onTime
andDate
from the functor intotiming_wheel_float_unit_tests.ml
.Split out
Timing_wheel.Debug
into a separate functor,Timing_wheel_debug.Make
.This was done in so that
Async_kernel
can depend only onCore_kernel
and notCore
.Added optional arguments to
Command.group
:?body
and?preserve_subcommand_order
.preserve_subcommand_order : unit
causes subcommands to be in the order they are specified, rather than sorted.body : (path:string list -> unit)
is called when no additional arguments are passed.Added accessor function
Command.summary : t -> string
.Fixed a bug in
Time.Span
robust comparison.Changed
Command
's tab-completion bash code so that it is possible for programs to return completions containing spaces.Actually knowing when and how to do so is difficult, because of course there's escaping to worry about. Adding helper functions to make that sort of thing manageable is left for future work.
In
Command
, made the-version
and-build-info
flags work at the top level when there are subcommands.Added
Sequence.interleaved_cartesian_product
, which implements cartesian product of potentially infinite sequences.
112.17.00
Deprecated the single-line files that simply
include
the corresponding Core_kernel module. Those are unnecessary, because people should useCore.Std
.We will keep these aliases around for a version before deleted them entirely.
Changed finalizers and signal handlers to, upon an unhandled exception, exit nonzero rather than asynchronously raise.
Removed
Time.Zone.find_office
.Replaced uses with the still-blocking
Time.Zone.find_exn
Made many changes to
Time
to make the time zone explicit instead of implicitly using the local timezone.Added
zone:Time.Zone.t
parameters to many functions. In almost all cases, used~zone:Time.Zone.local
where previously it was implicit.Removed
of_local_ofday
andto_local_ofday
in favor of the explicit versions (withTime.Zone.local
).Removed
Time.Zone.machine_zone ()
in favor oflocal
.Exported
Core.Std.With_return
.Exposed
Core.Std.with_return_option
.Fixed
Time_ns.Ofday.of_span_since_start_of_day
to check its input.Changed
Time_ns.to_span
andof_span
to round to microseconds, for round trippability.Added
Unix.Error
module, for theUnix.error
type.Added
Unix.Syscall_result
, a new abstract type representing the result of a Unix system call as anint
, to avoid allocation.A lot of Unix system calls return an integer on success, so for ones that are called a lot, we can encode errors as
-errno
. This module abstracts this concept.Changed
Iobuf.recvmmsg
functions to return the newUnix.Syscall_result
.Changed
Unix.exec
's?env
argument to support extending the environment in addition to replacing it.Added
with compare
toUnix.Exit.t
andUnix.Exit_or_signal.t
.Moved
Backtrace
toCore_kernel
.Deleted
backtrace_stubs.c
, now that we havePrintexc.get_callstack
.Changed
Bigstring.read_assume_fd_is_nonblocking
andsend_nonblocking_no_sigpipe
to returnUnix.Syscall_result.t
, to reduce allocation.Changed
Iobuf.send_nonblocking_no_sigpipe
to handleEINTR
likeEAGAIN
, instead of raising.Added
Command.Spec.char
.Changed
Process_env.parse_ssh_client
to accept anSSH_CLIENT
that is just IP address without ports.
112.06.00
Renamed
Linux_ext.gettid
asUnix.gettid
, and added OpenBSD support.SYS_gettid
is not available on OpenBSD, but is used inCore_extended
. See the mailing list discussion about this here:https://groups.google.com/forum/#!topic/ocaml-core/51knlnuJ8MM
Seems like the OpenBSD alternative is:
pid_t getthrid(void);
although it's not defined in any header file, which is a bit unfortunate.
Added
Piecewise_linear.precache
, which computes a lookup table that speeds up subsequent calls toPiecewise_linear.get
.Added
Time_ns
module, representing times as 63-bit integers of nanoseconds since the epoch.Fixed build of
unix_stubs.c
on OpenBSD.In
Daemon
, fixed an error message regardingWSTOPPED
(fixes #47).Added
Time.Span.Stable.V2
, with sexps that use new suffixes for microseconds (us
) and nanoseconds (ns
).Time.Span.of_string
supports the new format, butTime.Span.to_string
doesn't yet produce it -- we plan to change that later, after the newof_string
has made it out more widely.Added
Time.Span.to_string_hum
, which gives more options for rendering time spans.Merged the
recvmmsg
stubs inBigstring
andIobuf
.Factored out a shared underlying
recvmmsg
call that both stubs use.Restored
-pedantic
by avoiding a C99 feature (variable-length stack arrays).Made
Date.t
abstract, and changed its representation from a 4-word record to an immediate int (packing year, month, day).In
Daemon
, changed the permissions of thestd{err,out}
files generated during daemonization from0o777
to0o644
.Moved
Thread_safe_queue
fromcore
tocore_kernel
.This was done so that
Async_kernel
can use it, eliminating one ofAsync_kernel
's dependencies onCore
.Thread_safe_queue_unit_tests
remainsCore
, at least for now, because it has some dependencies on other stuff inCore
.
112.01.00
Removed vestigial code supporting OCaml 4.00.
Added
Command
support for flags that are passed one or more times.Added
Command.Spec.one_or_more
andCommand.Spec.non_empty_sequence
to deal with the cases where you expect a flag or anonymous argument (respectively) to be passed one or (optionally) more times. This is common enough and distinct from the case where you want the argument passed zero or more times that it seems like we should canonize it in the library.In
Lock_file
, made stale lock detection more robust.Made
Lock_file.create foo
succeed iffoo
is absent andfoo.nfs_lock
file is present and stale. Previously, it would fail.Removed
Syslog.syslog
'sadd_stderr
argument; use thePERROR
option instead.Fixed
unix_stubs.c
compilation on NetBSDCloses #45
Added
Filename
operators/^
and/@
, andof_parts
, like the same functions for Catalog paths.Changed
Iobuf
functions that advance the iobuf to not also return a redundant number of bytes processed.This avoids a small allocation (in the case of the
int option
functions) and normalizes the result (so the same information isn't returned two ways). Actually, it doesn't yet avoid the allocation in the implementation, as the correspondingBigstring
functions must still return the number of bytes processed, and currently do so as an option. We hope to eventually change that.In the future I expect we will change
unit
to someerror
variant to also avoid the exception construction forEWOULDBLOCK/EAGAIN
. We can even make Unix syscallsnoalloc
if we're careful.In
Unix
module, added unit tests forCidr.does_match
.
111.28.00
Added
Piecewise_linear.create_from_linear_combination
.val create_from_linear_combination : (t * float) list -> t Or_error.t
Added
Time.is_{earlier,later} : Time.t -> than:Time.t -> bool
, which are easier to read thanTime.(<)
and friends.Added
Command.exec
, which allows one to include theCommand
hierarchy from one executable in another.Command.exec
takes the file path to an executable that uses theCommand
module and returns aCommand.t
that integrates the executable (by exec'ing it), including providing recursive help and autocompletion as if it were a standardCommand.t
.Replaced most uses of
Hashtbl.replace
withHashtbl.set
.Renamed
Float.epsilon
torobust_comparison_tolerance
, to avoid confusion withepsilon_float
.
111.25.00
Added
Gc.disable_compaction
function.Added
Time.to_string_abs_trimmed
, which prints a trimmed time and takes azone
argument.Fixed
unix_stubs.c
to suppress a warning when building with some versions of gcc.Changed
Time.Zone
to allow the zoneinfo location to be specified by an environment variable.Closes #40
Fix compatibility with 4.02
111.21.00
Fixed an issue where
Time.Zone.init
would not properly traverse the directory containing timezone information.Added
Time.With_utc_sexp
, which has stable serialization ofTime.t
that is byte-for-byte equal across timezones.Made
Uuid
stable.Made
Piecewise_linear
stable.
111.17.00
Fixed a bug in
Bigstring.really_recv
ifrecv
doesn't receive all the data it wants.This bug has been around forever; it may not have caused trouble because
Bigstring.really_recv
(1) is barely used (the only use is inBigstring.unmarshal_from_sock
) and (2) passesrecv
theMSG_WAITALL
flag, so it will read the full amount unless it gets interrupted by a signal.Fixed
Bigstring.read
's handling ofEINTR
so that it retries rather than returning zero.This fixes a bug introduced in 111.09 in the interaction between
Bigstring.read
andAsync.Reader
. Prior to 111.09,Bigstring.read
would raise onEINTR
, andAsync.Reader
would propagate the exception. From 111.09 to 111.16,Bigstring.read
would return zero, which would confuseAsync.Reader
into thinking it reached EOF when it hadn't. From 111.17,Bigstring.read
will retry and not return zero when not at EOF.We believe the bug was rare, because otherwise we would have frequently seen
EINTR
exceptions prior to 111.09.Added
Command.Spec.apply
andpair
, which allow one to program more withSpec.param
rather thanSpec.t
.val apply : ('a -> 'b) param -> 'a param -> 'b param val pair : 'a param -> 'b param -> ('a * 'b) param
Added
Command.Spec.file
, which builds anArg_type
value with the same autocompletion asSpec.file
.(** [file] defines an [Arg_type.t] that completes in the same way as [Command.Spec.file], but perhaps with a different type than [string] or with an autocompletion key. *) val file : ?key:'a Univ_map.Multi.Key.t -> (string -> 'a) -> 'a t
111.11.00
Change some
Bigstring
functions to retry onEINTR
rather than raise.The following functions (and their unsafe versions) were affected:
read
really_read
really_recv
really_write
really_send_no_sigpipe
Some other
Bigstring
functions, likeinput
andoutput
, already retried onEINTR
, so this change has precedent.All of the affected stubs raise
Bigstring.IOError
on failure, rather thanUnix_error
, which means the normal method for retrying onEINTR
doesn't work. In particularAsync.Reader
didn't retry them, even though it was supposed to.Additionally, the documentation for the following functions was corrected to say that they raise =Unix_error= rather than =IOError=:
pread_assume_fd_is_nonblocking
pwrite_assume_fd_is_nonblocking
Eliminated global binary-to-decimal tables computed at startup for converting
Date
andOf_day
to string.Used an efficient implementation of division by 10, rather than the
sprintf
tables intime_internal.ml
. This result in much less allocation at startup and it is a bit faster:before:
Name Time/Run mWd/Run Percentage Date.to_string 69.39ns 3.00w 100.00% after:
Name Time/Run mWd/Run Percentage Date.to_string 53.38ns 3.00w 100.00% Fixed
Time.Zone
tests so that they are deterministic.Added
Iobuf.to_string_hum
, which produces a readable, multi-line representation of an iobuf, intended for debugging.Fixed brittle unit tests of
Command
.
111.08.00
Improved
Command
to print a good error message if command-line parsing raises.Command
'sExn.handle_uncaught
now protects the phase of parsing command-line arguments in addition to protecting the phase of running themain
function as it did already.
111.06.00
Added inline benchmarks for =Iobuf= and =Time=.
Hera are some of the results from the new benchmarks, with some indexed tests dropped.
Name Time/Run mWd/Run Percentage [time.ml:Time] Time.to_string 848.74ns 249.98w 100.00% [time.ml:Time] Time.to_ofday 59.66ns 38.00w 7.03% [time.ml:Time] Time.now 39.78ns 2.00w 4.69% [time.ml:Time] Time.Zone.find_office 83.64ns 4.00w 9.85% [time.ml:Time] Time.Span.of_hr 3.71ns 2.00w 0.44% [time.ml:Time] Time.Span.of_min 3.69ns 2.00w 0.44% [time.ml:Time] Time.Span.of_sec 2.72ns 0.32% [time.ml:Time] Time.Span.of_ms 6.02ns 2.00w 0.71% [time.ml:Time] Time.Span.of_ns 5.98ns 2.00w 0.71% Name Time/Run Percentage [iobuf.ml:Blit tests] functor blit:5 15.53ns 7.66% [iobuf.ml:Poke tests] char:0 4.11ns 2.03% [iobuf.ml:Poke tests] uint8:0 5.35ns 2.64% [iobuf.ml:Poke tests] int8:0 4.59ns 2.26% [iobuf.ml:Poke tests] int16_be:0 5.19ns 2.56% [iobuf.ml:Poke tests] int16_le:0 5.14ns 2.53% [iobuf.ml:Poke tests] uint16_be:0 5.11ns 2.52% [iobuf.ml:Poke tests] uint16_le:0 5.12ns 2.53% [iobuf.ml:Poke tests] int32_be:0 5.17ns 2.55% [iobuf.ml:Poke tests] int32_le:0 4.91ns 2.42% [iobuf.ml:Poke tests] uint32_be:0 5.73ns 2.83% [iobuf.ml:Poke tests] uint32_le:0 5.74ns 2.83% [iobuf.ml:Poke tests] int64_be:0 5.33ns 2.63% [iobuf.ml:Poke tests] int64_le:0 4.93ns 2.43% [iobuf.ml:Peek tests] char:0 5.50ns 2.71% [iobuf.ml:Peek tests] uint8:0 4.68ns 2.31% [iobuf.ml:Peek tests] int8:0 4.91ns 2.42% [iobuf.ml:Peek tests] int16_be:0 5.19ns 2.56% [iobuf.ml:Peek tests] int16_le:0 4.90ns 2.42% [iobuf.ml:Peek tests] uint16_be:0 5.17ns 2.55% [iobuf.ml:Peek tests] uint16_le:0 5.10ns 2.51% [iobuf.ml:Peek tests] int32_be:0 5.17ns 2.55% [iobuf.ml:Peek tests] int32_le:0 4.92ns 2.42% [iobuf.ml:Peek tests] uint32_be:0 5.45ns 2.69% [iobuf.ml:Peek tests] uint32_le:0 5.46ns 2.69% [iobuf.ml:Peek tests] int64_be:0 6.61ns 3.26% [iobuf.ml:Peek tests] int64_le:0 6.31ns 3.11% Re-implemented
Thread_safe_queue
to improve performance and reduce allocation.The new implementation requires 3 words per element, down from the 7 words required by the old implementation.
The new implementation pools elements so that they can be reused, so there is no allocation in steady-state use.
The new implementation has
dequeue_exn
rather thandequeue
, so that one can dequeue without allocating 2 words.Eliminated
create'
. One should just usecreate
and explicit calls toenqueue
anddequeue_exn
.Eliminated
dequeue_until_empty
. One should use an explicit while loop guarded bylength
and usingdequeue_exn
.Moved
Thread_safe_queue
fromCore_kernel
toCore
, since it's thread related.All in, there is now no allocation in a steady-state usage of enqueueing and dequeueing elements, as opposed to 9 words per
enqueue+dequeue
in the old implementation. This reduces the cost fromenqueue+dequeue
taking 166-216ns toenqueue+dequeue_exn
taking 48-82ns (plus eliminating gc impacts). Here are someBENCH
results, the first table being the old implementation, and the second table the new.Name Time/Run mWd/Run mjWd/Run [thread_safe_queue.ml] enqueue + dequeue of immediate 183.89ns 9.00w 7.02w [thread_safe_queue.ml] enqueue + dequeue of young object 216.69ns 11.00w 9.01w [thread_safe_queue.ml] enqueue + dequeue_exn of old object 166.75ns 9.00w 7.02w Name Time/Run mWd/Run [thread_safe_queue.ml] enqueue + dequeue_exn of immediate 48.20ns [thread_safe_queue.ml] enqueue + dequeue_exn of young object 81.96ns 2.00w [thread_safe_queue.ml] enqueue + dequeue_exn of old object 48.30ns Changed
{Bigstring,Iobuf}.recvmmsg_assume_fd_is_nonblocking
, when no message is available, to return a negative number rather than raise.This was done for performance reasons, because raising an exception is expensive, due to the stashing of the backtrace and the string creation.
Added
Iobuf.unsafe_resize
.Changed
Bigstring.blit
so that it doesn't release the OCaml lock onmap_file
bigstrings.The old behavior of releasing the lock for blits of (small) bigstrings involving mmapped files was problematic and inconsistent. Its cost is high, and fundamentally any access to a mapped bigstring could cause some level of blocking.
Added time-related
Arg_type.t
values toCommand.Spec
.Added module
Type_immediacy
, which has witnesses that express whether a type's values are always, sometimes, or never immediate.This code used to be in the
Typerep_immediate
library in typerep.
111.03.00
Added
Unix.Syslog
module.Changed
Command.run
to no longer ignore the first element of its~argv
parameter.Made
Time.Span.to_short_string
show microsecond precision.
110.01.00
Fixed
Time
unit tests that failed in London because of timezone dependence.Added
Iobuf.protect_window_and_bounds
, which calls a user function and restores the iobuf's bounds afterwards.Fixed compilation on OpenBSD, which doesn't support
Unix.mcast_join
's?source : Inet_addr.t
argument.
109.60.00
Added
Iobuf.unsafe_advance
.This can be used to benchmark inner loops that have redundant bounds checking, to see if the checks matter. For example, see the following two
advance
calls:let rec process_buffer buf ~f = let len = Iobuf.length buf in if header_len <= len then let msg_len = header_len + Iobuf.Unsafe.Peek.uint16_be buf ~pos:0 in if msg_len <= len then begin let len = msg_len - header_len in Iobuf.advance buf header_len; f (Protocol.packed_of_iobuf buf); Iobuf.advance buf len; process_buffer buf ~f end
Added
Weak_hashtbl.add_exn
andsexp_of_t
.Fixed
Lock_file.create
to behave correctly if the target mountpoint is out of space.Previously in this situation,
Lock_file.create
would create an empty lock and exit with exception trying to write pid/message there. Subsequent runs would not able to read pid out of empty pid file andblocking_create
would block instead of removing defective lock.
109.58.00
Added
Debug.should_print_backtrace : bool ref
, to control whetherDebug.am*
functions print backtraces.Added to
Float
inline benchmarks.Moved all of the
Gc
module intoCore_kernel
.Part of the
Gc
module used to be inCore
because it used threads. But it doesn't use threads anymore, so can be all inCore_kernel
.Improved
Iobuf
support for copying to/from strings and bigstrings.The new modules are
Iobuf.{Consume,Peek}.To_{bigstring,string}
. They match aBlit
-like interface. We don't yet implement theBlit
interface in all applicable contexts, but do useBlit.Make
and expose some of the operations we want in the forms we expect them to take under aBlit
interface.Added
Linux_ext.Timerfd.to_file_descr
.Added to
Time.next_multiple
an optional argument to control whether the inequality withafter
is strict.Added
Time.Zone.local
, a lazily cachedTime.Zone.machine_zone ()
.This is the first stage in a plan to make explicit timezones more pervasive. First, they are made more convenient, by replacing the relatively wordy
Time.Zone.machine_zone ()
withTime.Zone.local
. This involves making the underlying timezone type lazy.The next stage will be to remove
machine_zone
and useTime.Zone.local
everywhere instead. Then (it is hoped) instead ofof_local_whatever
, we just say e.g.of_date_ofday Time.Zone.local
and currently-implicitly-local functions will be able to switch over to explicit timezones without becoming too verbose.Added
Timing_wheel.Alarm.null
.Made
Unix.File_descr.t
havewith sexp
.Closes janestreet/async_unix#3
Fixed OpenBSD compilation failures in C stubs.
Fixed
Lock_file.is_locked
to require read permission, not write permission, on the lock file.Added to
Unix.mcast_join
an optional?source:Inet_addr.t
argument.From pull-request on bitbucket: https://bitbucket.org/janestreet/core/pull-request/1/receive-source-specific-multicast/diff
109.55.00
Fixed building on FreeBSD and OpenBSD.
Added
with typerep
to manyCore
types.Made
open Core.Std
supportwith typerep
.Added
Iobuf.recvmmsg_assume_fd_is_nonblocking_no_options
, a specialization ofrecvmmsg_assume_fd_is_nonblocking
for improved performance.This improvement was driven by profiling at high message rates.
Changed
Unix.Rlimit.virtual_memory
be anOr_error.t
, for platforms where it is undefined.
109.53.00
Added
Linux_ext.Epoll.close
.Added
Weak_hashtbl
module, moved fromAsync
.It had only been in
Async
to useAsync
's finalizers. The move toCore
exposes a bit more with respect to finalization so that one can still implementAsync.Weak_hashtbl
, as well as do other things (e.g. useWeak_hashtbl
inIncremental
, which does not useAsync
).Simplified the implementation of
Weak_hashtbl
to eliminate "entry ids". They were only used to avoid removing a table entry that was in use. But there is a more direct way to test for that -- just check if the weak isNone
orSome
.Added an autoload file for utop
Disabled warning 40 in corebuild
109.52.00
Added
Unix.File_descr.equal
.Added
Lock_file.Nfs.unlock
, theOr_error
version ofunlock_exn
.Improved the detail of the error messages exposed by
Lock_file.Nfs.create{,_exn}
.Added
Unix.set_mcast_ifname
, to control the interface used for UDP multicast traffic.Added bindings for setsockopt
IP_MULTICAST_IF
.See 6.3 in: http://www.tldp.org/HOWTO/Multicast-HOWTO-6.html
Changed
Command
argument processing to treat a single dash (-
) as an anonymous argument rather than a flag.This change follows the unix convention of passing
-
as an anonymous argument meaningstdin
.Added more bin-prot support to
Iobuf
:Consume.bin_prot
,Fill.bin_prot
,Peek.bin_prot
,Poke.bin_prot
.Framing doesn't do much for
Iobuf
, so these are to be more standard, unframed accessors, as opposed tofill_bin_prot
.Added
Core.Debug.am
,amf
, andams
, for outputting debugging messages showing the current source-code position.Unfortunately, these aren't available in
Core.Std.Debug
, but only inCore.Debug
. That will be fixed in 109.49.Made
Time_stamp_counter
compile on non x86-64 platforms.Made
Core.Std.Debug
beCore.Debug
rather thanCore_kernel.Debug
.This exposes the
Debug.am*
functions added in 109.48.
109.47.00
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 theRDTSC
instruction. For systems that do not have a RDTSC instruction, we fallback to usingclock_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.Changed
Daemon.daemonize
anddaemonize_wait
to leave theumask
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.
109.45.00
Added
Core.Std.phys_same
, which is likephys_equal
, except has a more general type.val phys_equal : 'a -> 'a -> bool val phys_same : _ -> _ -> bool
phys_same
is useful when dealing with existential types, and one has a packed value and an unpacked value that one wants to check are physically equal. One can't usephys_equal
in such a situation because the types are different.Added
Iobuf.set_bounds_and_buffer
andset_bounds_and_buffer_sub
, which make it easier to use with zero allocation.(** [set_bounds_and_buffer ~src ~dst] copies bounds (ie limits + window) and shallowly copies the buffer from [src] to [dst]. [read_write] access is required on [src] because the caller might have [read_write] access to [dst], and would after the call then effectively have [read_write] access to [src]. *) val set_bounds_and_buffer : src:(read_write, _) t -> dst:(_, seek) t -> unit (** [set_bounds_and_buffer_sub ?pos ?len ~src ~dst ()] is a more efficient version of: [set_bounds_and_buffer ~src:(Iobuf.sub ?pos ?len src) ~dst]. [set_bounds_and_buffer ~src ~dst] is not the same as [set_bounds_and_buffer_sub ~dst ~src ()], because the limits are narrowed in the latter case. *) val set_bounds_and_buffer_sub : ?pos:int -> ?len:int -> src:(read_write, _) t -> dst:(_, seek) t -> unit -> unit
Added
?timeout:Time.Span.t
argument toLock_file.blocking_create
,Lock_file.Nfs.blocking_create
andcritical_section
.
109.44.00
Added
val Day_of_week.num_days : from:t -> to_:t -> int
.Added
Time.of_date_ofday_precise
andTime.Zone.next_clock_shift
, to deal with clocks going forward and backward.Due to clocks going forward/backward, some local times occur twice, and some never occur at all.
Time.of_date_ofday_precise
identifies these cases and returns all of the relevant information.Added accessors for
Unix.Cidr
:base_address
andbits
.(** Accessors. - [base_address 192.168.0.0/24 ` 192.168.0.0] - [bits 192.168.0.0/24 ` 24]. *) val base_address : t -> Inet_addr.t val bits : t -> int
109.42.00
Removed
Zone
fromCore.Std
; useTime.Zone
instead.Removed
Time.Date
; useDate
instead.Improved the performance of
Piecewise_linear
by using arrays with binary search on indices.The previous implementation
Piecewise_linear
used(float * float) list
(a list of (x,y) pairs) to represent piecewise linear functions, with a linear search through the knots to evaluate the function at a point. This type is now:{ x : float array ; y : float array }
and the implementation uses binary search to identify the correct array index.
Here are the costs of the
get
function under the old (list) and new (array) implementations for various numbers of knots:knots | old | new ------+------+----- 1 | 11ns| 12ns 2 | 18ns| 14ns 5 | 27ns| 19ns 100 | 182ns| 38ns 1000 |1974ns| 52ns
Added module
Time.Ofday.Zoned
, which is a pair of anTime.Ofday.t
and aTime.Zone.t
.Added
with compare
toTime.Zone.Stable.t
.Added
Timing_wheel
functionality.Added
Config
module, which combinesalarm_precision
andtiming_wheel_level_bits
.Removed the need to supply a dummy value to
create
.Added
mem
andclear
functions.Added functions for dealing with the interval number:
interval_num
,now_interval_num
,interval_num_start
,add_at_interval_num
.
This makes it easier to use a timing wheel with
int
interval numbers, which are more efficient than thanfloat
times.
109.41.00
Added
Command.Spec.map_anon
andmap_flag
.(** [map_flag flag ~f] transforms the parsed result of [flag] by applying [f] *) val map_flag : 'a flag -> f:('a -> 'b) -> 'b flag (** [map_anons anons ~f] transforms the parsed result of [anons] by applying [f] *) val map_anons : 'a anons -> f:('a -> 'b) -> 'b anons
Fixed
Unix.open_flag
to compile with OCaml 4.01.It needed the additional constructor
O_CLOEXEC
.
109.37.00
Command.run now calls Exn.handle_uncaught so you don't have to.
Fixes for building on FreeBSD.
Fixed Blang to build with OCaml 4.01.
In blang.mli:
Blang.t is a private variant type, Blang.Stable.V1.t is a private variant type, and client code knows Blang.t = Blang.Stable.V1.t. Previously, this was done in a strange way, using with type 'a t = private 'a t on the signature of Blang.Stable.V1. In addition to being strange, this line no longer builds in OCaml 4.01, which caused problems for building Real World Ocaml.
This patch changed the code to something much more straightforward, although not quite so straightforward as we expect to be able to achieve once a nonrec bug is fixed.
109.35.00
Added
or_error
functions inUnix.Exit_*
types tounit Or_error.t
.This makes it easier to deal with combining with infix operators
>>=?
and>>|?
109.34.00
Added
val Backtrace.get_opt : unit -> t option
.This is more convenient to use than
Backtrace.get
, which is anOr_error.t
.Moved functions for dealing with finalizers into the
Gc.Expert
module.This was done to make people be very explicit and sure that they want finalizers, which are very hard to use because they essentially introduce multithreading semantics.
One should typically use async finalizers.
Eliminated the thread that had been used to sequentialize all finalizers.
109.32.00
Normalized
Command
's help messages.Made anonymous argument names uppercase and subcommand names lowercase.
In
Iobuf
, added duals toflip
andsnapshot
to work on the high end of the window.flip
has been renamed toflip_lo
. The dual offlip_lo
is the newly addedflip_hi
, and shifts the window forward to continue reading, rather than back to switch from writing to reading, asflip_lo
does.flip_hi
, in practice, needs snapshots of the upper bound of the window, we splitSnapshot
intoLo_bound
andHi_bound
and introduced bounded versions offlip_lo
,compact
, andflip_hi
to support buffers which are only partially filled, but have substructure, like packet buffers.Here's the new API.
module type Bound = sig type ('d, 'w) iobuf (** Expose =t = private int= only if a =t= is stored in a mutable data structure somewhere and leads to a measurable =caml_modify= performance problem. *) type t with sexp_of val window : (_, _) iobuf -> t val limit : (_, _) iobuf -> t val restore : t -> (_, seek) iobuf -> unit end module Lo_bound : Bound module Hi_bound : Bound val flip_lo : (_, seek) t -> unit val bounded_flip_lo : (_, seek) t -> Lo_bound.t -> unit val flip_hi : (_, seek) t -> unit val bounded_flip_hi : (_, seek) t -> Hi_bound.t -> unit
109.30.00
Created submodule
Core.Signal.Expert
module.This is for functions previously in
Core.Signal
that introduce multithreading semantics, and are hence hard to reason about and should only be used by experts.
109.28.00
Moved
Timing_wheel
fromZero
.
109.27.00
Disabled use of
recvmmssg
, which isn't available on our CentOS 5 machines.Defined
Option.compare
usingwith compare
so that their comparisons are consistent.Cleaned up the
Dequeue
module's interface and implementation.The interface now matches the conventions used elsewhere in
Core
. The new implementation is also cleaner and more efficient.Reimplemented the
Stack
module to improve performance, and renamed the old implementation asLinked_stack
.The new
Stack
is implemented with this type:type 'a t ` { dummy : 'a; mutable length : int; mutable elts : 'a array; }
Linked_stack
is implemented with this type:type 'a t ` { mutable length : int; mutable elts : 'a list; }
Using an array rather than a linked list is a more efficient and traditional implementation. Pushing to the stack now does not require allocation, except in the rare case when the stack grows.
One downside is that
Stack.clear
is now O(n) rather than O(1).This change also eliminates the
Stack.Empty
exception, so any code matching on that exception should fail to compile, and should be changed to depend on option-returningtop
andpop
operations.Improved
Lock_file.Nfs
.Allowed an arbitrary message to be stored and retreived.
Fixed a case where
create
might throw an exception.Delete both files used for locking when we unlock.
Split
Core
intoCore_kernel
andCore
.Core_kernel
is composed of all modules ofCore
that do not depend on unix or threads, andCore
contains the rest and depends onCore_kernel
.The goal is to have a very portable standard library that can especially run on exotic environment such as Javascript.
So that code that directly refers to
Core
(rather thanCore.Std
) for modules that have moved toCore_kernel
, we included "proxy" modules inCore
that simply include the corresponding module fromCore_kernel
.Fixed
Core.Flags
to build on 32-bit machines.It had contained a unit test with an integer literal too large to be accepted by the compiler when building on a 32-bit machine.
109.24.00
Added module
Core.Iobuf
, a module aimed at zero-copy I/O.An iobuf is a bigstring combined with a position and length, that defines a contiguous region of bytes in the bigstring. Operations on an iobuf operate relative to start of the region and cannot look outside the region.
Added module
Core.Validated
for creating an abstract type that ensures a validation function has been run.Added function
Bigstring.recvmmsg_assume_fd_is_nonblocking
, which allows one to read a number of UDP packets with a single system call.Fixed
Unix.create_process
on OSX.
109.23.00
Exposed
Core.Std.Flags
module.Made the
Heap
module implementContainer.S1
.Added module
Ref.Permissioned
, which is a ref withread_only
/read_write
access control.Exposed the unique id in
Type_equal.Id
.This allows, e.g. hash tables indexed by unique ids.
Removed the use of
Obj.magic
from the implementation ofType_equal.Id.same
.It is not needed because the
Id.t
contains aUid.t
and we can just useUid.equal
.
109.21.00
Massively improved the signatures of
Map
andSet
, both for readability and ocamldoc, as well as improved type error messages.For instance the type of
Int.Set.singleton
was:('a, 'comparator, 'a Core.Std.Int.Set.elt_ -> ('a, 'comparator) Core.Std.Int.Set.t_) Core.Core_set_intf.without_comparator
Now it is simply:
int -> Int.Set.t
Added an optional argument to
Command.run
that can be used to specify default flags from a user config file.The optional argument can extend the command line based on the path to the command.
Rename module
Weekday
asDay_of_week
.The name
Weekday
conflicted with ordinary usage of "weekday" to mean Monday through Friday.Changed
sexp_of_t
for{Month,Ofday,Time,Time.Span}.{Set,Map}
to use the nice sexp format of the underlying atomic type.Previously, the converter had used thes raw type (
float
,int
, etc.).t_of_sexp
still accepts both formats; we will remove the ability to accept the raw format in the distant future.This output-format change was planned when we originally in 108.06b improved those
t_of_sexp
functions to accept both formats.Added
Unix.remove
.Removed some
IFDEF
's connected to OCaml <4 support.
109.20.00
Wrapped
Unix.wordexp
in anOr_error.t
since it is not available on all systems.Added function
Process_env.parse_ssh_client
. This gets the address from which you're currently ssh'd in.Added to
Unix
module the ability to get and setIP_MULTICAST_LOOP
andIP_MULTICAST_TTL
.Exposed module
Core.Std.Ref
, which was previously only available viaCore.Ref
.Remove
Mutex.am_holding_mutex
and changed the type ofMutex.try_lock
.With NPTL it is impossible to determine which thread is holding the lock. So,
Mutex.am_holding_mutex
is unimplementable. Also,Mutex.try_lock
was incorrect because it claimed to raise if one was attempting to recursively lock. Since it's not possible to distinguish between recursive locking and the lock being held by another thread, we changed the type to make this clear:val try_lock : t -> [ `Already_held_by_me_or_other | `Acquired ]
Removed our custom version of the OCaml runtime's
core_sys_open
function.There used to be a bug in the OCaml runtime, PR#5069, in which
open_{in,out}_gen
could block while holding the OCaml lock, because they made a call tofcntl
outside the blocking section. We had our own C code with the bug fix and re-exposed the fixed versions of the functions inCore
.The bug in OCaml has been fixed, so we have removed our patched function from
Core
.In
unix_stubs.c
, switched from usingFNM_FILE_NAME
toFNM_PATHNAME
.The GNU project introduced FNM_FILE_NAME as a non-portable synonym for FNM_PATHNAME.
We were using pre-processor macros to define FNM_FILE_NAME as FNM_PATHNAME if unavailable, but it is simpler to just use the more portable FNM_PATHNAME everywhere.
109.19.00
Changed
Time.to_string
andTime.sexp_of_t
to include the timezone.This is an incompatible change with very old programs in which
Time.of_string
andTime.t_of_sexp
did not support the timezone.If you have programs that are:
very old and do Time string/sexp handling
rely on reading in time values without using
Time.of_string
andTime.t_of_sexp
.rely on chains of writing/reading/writing times across machines and timezones where the time is always intended to be taken as the local time on the currently reading machine
you should recompile/review your code to make sure you won't have issues.
Added function
List.remove_consecutive_duplicates : 'a t -> equal:('a -> 'a -> bool) -> 'a t
.This returns the input list with consecutive duplicates removed, and doesn't change the order of the remaining elements.
Added module
User_and_group
, which is a pair of a unix username and primary unix group.The string/sexp converters follow the usual unix convention of
<user>:<group>
.Added function
Date.first_strictly_after : t -> on:Weekday.t -> t
.first_strictly_after t ~on:day_of_week
returns the first occurrence ofday_of_week
strictly aftert
.Added functor
Type_equal.Lift
.It is always safe to conclude that if type
a
equalsb
, then typea X.t
equalsb X.t
, for any typeX.t
. The OCaml type checker uses this fact when it can. However, sometimes, e.g. when usingType_equal.conv
, one needs to explicitly use this fact to construct an appropriateType_equal.t
. TheType_equal.Lift*
functors do this.module Type_equal : sig type ('a, 'b) t ... module Lift (X : T1) : sig val lift : ('a, 'b) t -> ('a X.t, 'b X.t) t end end
109.18.00
changed implementation of
Array.sort
to use introsort.See http://en.wikipedia.org/wiki/Introsort.
tweaked a unit test in
Core.Flags
to not print a message to stderr.
109.17.00
Fixed
Random.self_init
, which was broken since 109.00.00 with the upgrade to OCaml 4.0The fix changed the type signature expressed in
core_random.ml
of the standard OCamlcaml_sys_random_seed
C function fromunit -> int
fromunit -> int array
. That C function changed between OCaml 3.12 and 4.0.Moved module
Core_extended.Unix.Cidr
intoCore.Unix
.Wrapped
Unix.wordexp
into anOr_error.t
to handle systems that does not implement it in the libc.Fixed two other printer names
Added
Array.int_blit
andArray.float_blit
, which are specialized fast blits forint array
andfloat array
.For motivation underlying this change and other design alternatives please see Section 3 "Fast, Slow and Incorrect Array blits" of http://janestreet.github.com/ocaml-perf-notes.html
Added
Unpack_buffer.Unpack_one.sexp
for parsing sexps using theUnpack_buffer
interface.
109.15.00
Changed the tolerance of
Time.Robustly_compare
functions from1E-7
to1E-6
.Fixed the names of some toplevel pretty-printers, which referred to nonexistent modules.
Fix some of the
pp
's for Core which are used to install printers in the top-level. Some of the toplevel printers refer to non-existent modules likeCore.Nativeint.pp
; this feature changed to the correct name, likeCore.Std.Nativeint.pp
.Added to module
Unix
functionality for getting and setting flags in the open-file-descriptor table.module Open_flags : sig type t include Flags.S with type t :` t ... end val fcntl_getfl : File_descr.t -> Open_flags.t val fcntl_setfl : File_descr.t -> Open_flags.t -> unit
Added module
Linux_ext.Timerfd
.This allows one to create a file descriptor that can be monitored by
epoll
orselect
and notify them at a certain time. It makes it possible to useepoll
with sub-millisecond timeouts.Added
Version_util.application_specific_fields
, which allows custom build-time information to be included in an executable.
109.14.00
Fixed major performance problem with hashing in
Int.Table
.Our
Int.Table.replace
was 3 times slower than polymorphic hash table andfind
was 8 times slower.This was caused by using:
external seeded_hash_param : int -> int -> int -> 'a -> int = "caml_hash" "noalloc"
in
Int.Table
but:external old_hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc"
everywhere else.
The
seeded_hash_param
was introduced in Caml 4.We fixed this problem by changing
Int.hash
from:let hash (x : t) = Hashtbl.hash x
to:
let hash (x : t) = if x >= 0 then x else ~-x
Added
Bigstring.{pread,pwrite}
, which allow reading and writing at a specific file offset.Added module
Nothing
, which is a type with no values.This is useful when an interface requires you to specify a type that you know will never be used in your implementation.
Changed
Identifiable.Make
so that it registers a pretty printer.Identifiable.Make
now usesPretty_printer.Register
. This requires all calls toIdentifiable.Make
to supply aval module_name : string
.Made
Core.Zone
match theIdentifiable
signature.Made polymorphic equality always fail on
Core.Map.t
andCore.Set.t
.Before this change, polymorphic equality on a
Core.Map
or aCore.Set
could either raise or returnfalse
. It returndfalse
if the data structures were unequal, and raised if the data structures were equal.This is because their type definitions looked like:
type ('k, 'v, 'comparator) t = { tree : ('k, 'v) Tree0.t; comparator : ('k, 'comparator) Comparator.t; }
and polymorphic equality visits a block's fields in order. So, it will detect unequal trees and return false, but if the trees are equal, it will compare the comparators and raise because of the functional value.
This change reversed the order of the fields so polymorphic equality always fails.
109.13.00
Added
Command.Spec.flags_of_args_exn
, for compatibility with OCaml's standard library.This function converts a
Core.Std.Arg.t
into aCommand.Spec.t
.Made various modules
Identifiable
:Char
,String
, and the variousInt
modules.In particular,
Int
being identifiable is useful, because one can now write:module My_numeric_identifier : Identifiable ` Int
You might think that we could now delete
String_id
, and just write:module My_string_identifier : Identifiable ` String
But this is not quite equivalent to using
String_id
, becauseString_id.of_string
enforces that its argument is nonempty.Removed module
Space_safe_tuple
, which became unnecessary in OCaml 4.00.0.OCaml 4.00.0 included Fabrice's patch to fix the space leak that
Space_safe_tuple
was circumventing (PR#5288, commit SVN 11085).Added
Exn.to_string_mach
, for single-line output.Added
Linux_ext.bind_to_interface
, to improve security of UDP applications.val bind_to_interface : (File_descr.t -> string -> unit) Or_error.t
This uses the linux-specifc socket option
BINDTODEVICE
to prevent packets being received from any interface other than one named.Fixed
Unix.mkdir_p
on Mac OS X.
109.12.00
Add some functions to
Byte_units
.Added functions:
to_string_hum
,scale
,Infix.//
.Eliminated the notion of "preferred measure", so a
Byte_units.t
is just afloat
.
Improved the performance of
Array.of_list_rev
.The new implementation puts the list elements directly in the right place in the resulting array, rather that putting them in order and then reversing the array in place.
Benchmarking shows that the new implementation runs in 2/3 the time of the old one.
Fixed
Fqueue.t_of_sexp
, which didn't work withsexp_of_t
.There was a custom
sexp_of_t
to abstract away the internal record structure and make the sexp look like a list, but there wasn't a customt_of_sexp
defined, so it didn't work.Added
Stable.V1
types forHost_and_port
.Removed
Identifiable.Of_sexpable
andIdentifiable.Of_stringable
, in favor ofIdentifiable.Make
Identifiable.Of_sexpable
encouraged a terrible implementation ofIdentifiable.S
. In particular,hash
,compare
, and bin_io were all built by converting the type to a sexp, and then to a string.Identifiable.Of_stringable
wasn't as obviously bad asOf_sexpable
. But it still used the string as an intermediate, which is often the wrong choice -- especially forcompare
andbin_io
, which can be generated by preprocessors.Added
Identifiable.Make
as the replacement. It avoids using sexp conversion for any of the other operations.Added
List.intersperse
andList.split_while
.These came from
Core_extended.List
.val intersperse : 'a list -> sep:'a -> 'a list val split_while : 'a list -> f:('a -> bool) -> 'a list ** 'a list
Added a functor,
Pretty_printer.Register
, for registering pretty printers. The codifies the idiom that was duplicated in lots of places:let pp formatter t = Format.pp_print_string formatter (to_string t) let () = Pretty_printer.register "Some_module.pp")
109.11.00
Added module
Interned_string
This has a functor for creating modules of interned strings. It uses the very simple mechanism of mapping distinct strings to consecutive ints.Added value
Hashtbl.find_and_remove
.
109.10.00
Added
|>
, which means the same as|!
, but is likely to replace it someday. This is mostly because|>
is an accepted notation elsewhere, particularly in F#. In the future, we will consider eliminating|!
in favor of|>
, so as to avoid the duplication.Made
module Lazy
into a monad.Renamed
List.stable_dedup_involving_an_application_of_the_set_functor
asList.stable_dedup_staged
. Made it useStaged.t
to make explicit the expectation of partial application.Added pretty printers for the toplevel to
Error
andInfo
.
109.09.00
In
Core.Std
, exposedOr_error.ok_exn
andOr_error.error
Removed some values exported by
Core.Std
.Removed some values from
Core.Std
that weren't widely used, or we didn't think should be exposed, includingascending
,descending
, andequal
, which use polymorphic comparison, and we want to discourage.Here's a guide to some of what was removed, and what one should now use instead.
| removed | replace with | |-----------------------------------+---------------------------------------| |
Int_replace_polymorphic_compare
|Int.Replace_polymorphic_compare
| |ascending
|Polymorphic_compare.ascending
| |descending
|Polymorphic_compare.descending
| |equal
|Polymorphic_compare.equal
| |ifprintf
|Printf.ifprintf
| |sscanf
|Scanf.sscanf
| |Scan_failure
|Scanf.Scan_failure
| |string_of__of__sexp_of
|Sexplib.Conv.string_of__of__sexp_of
| |of_string__of__of_sexp
|Sexplib.Conv.of_string__of__of_sexp
| |type vec
|type float64_vec
|Disallowed
<:sexp_of<
with two underscores; using a single underscore instead.Added
Command.Spec.Arg_type.of_alist_exn
as an alternative forof_map
. This captures the common pattern to create the map from an alist.Improved the performance of
Hashtbl
. Constrained hashtbl size to a power of two and used a bitmask rather than mod operation for finding hash buckets.Improved the performance of
Univ
, using theType_equal
GADT. The new implementation improves the run-time and space usage over the old one. In the old implementation, aUniv.t
was represented as record with three fields: an exception, a string, and a closure. Creating a univ required allocating three heap blocks, the exception (3 words), the closure (3 words), and the three-field record (4 words). In the new implementation, aUniv.t
is represented as a 2-field heap block containing theConstr.t
and the value. Creating a univ allocates that single 3-word block, improving on the 10 words needed previously.Matching on univs is also faster. In the old implementation, matching on a univ required making a function call, testing exception equality, and allocating a
Some
block. Now, it does just the test and allocation. Furthermore, it is possible to usedoes_match
andmatch_exn
to avoid the allocation.Added
Version_util.build_info_as_sexp
.Added
_squelch_unused_module_warning_
toComparable.S.Replace_polymorphic_compare
.
109.08.00
Cleaned up and updated the
README
.Changed executables to enable backtraces if
OCAMLRUNPARAM
is not set.Changed
Command
so that executables show build info and version info This happens when an executatble is called as:foo.exe version
Before this change, rather than display build info, executables would display the not-so-helpful:
(no option given - printing version)
Added back
Float
rounding functions with a hardcoded direction.Exposed
with bin_io
andwith compare
for the =sexp_bool= type.Added value
Core.Never_returns.sexp_of_t
.Added values
Or_error.tag{,_arg}
These are analogous toError
functions of the same name.Added functor
Sexpable.Of_sexpable
This is for serializing values of one type as though it were some other isomorphic type.Added module
Backtrace.Exn
This exposes OCaml stdlib'sPrintexc
functions for backtraces.Added module
Flags
This implements Unix-style sets of flags that are represented as anint
with various bits set, one bit for each flag, e.g.,Linux_ext.Epoll.Flag
.Added module
Uuid
This module implements universally unique identifiers based on version 3 of the UUID specification. It used to be inCore_extended=
Added module
Type_equal
, which defines the "equality" GADT.
109.07.00
Added a number of functions to =Bounded_int_table=: =equal=, =exists{,i}=, =for_all{,i}=, =filter_map{,i}=, =map{,i}=. Also added a functor, =Bounded_int_table.With_key=, that makes a bounded-int table binable and sexpable, and adds =of_alist= and =of_alist_exn=.
Added =Doubly_linked.iter_elt= and =Bag.iter_elt=.
Added =module Invariant=, which defines signatures that are to be included in other signatures to ensure a consistent interface to invariant-style functions.
Added =module Ordering=, which defines: =type t = Less | Equal | Greater=
109.06.00
Added [Map.symmetric_diff], for returning a list of differences between two maps. It has a fast-path implementation for maps that share a large amount of their internal structure.
109.05.00
Updated [Core.Unix.stat] so that access, modify, and change times have nanosecond precision.
Fixed a bug in [Nano_mutex.invariant].
Simplified the implementation of [with_return] using a local explicit polymorphic type variable.
109.04.00
Fix [Backtrace.get], which was broken in 109.00, with the switch to OCaml 4.0.
Added [Heap.iter_el].
109.02.00
Add Char.of_string