Skip to content

GADTs + inline records for more efficient doubly linked lists#58

Open
mmottl wants to merge 1 commit intojanestreet:masterfrom
mmottl:doubly-linked-gadt
Open

GADTs + inline records for more efficient doubly linked lists#58
mmottl wants to merge 1 commit intojanestreet:masterfrom
mmottl:doubly-linked-gadt

Conversation

@mmottl
Copy link
Copy Markdown

@mmottl mmottl commented Oct 11, 2016

This branch implements the same kind of efficiency improvement as the one recently submitted for the union-find algorithm. Though the patch touches many lines, the vast majority of changes are completely trivial and easily recognized as correct.

The patch will require the upcoming OCaml 4.04 (or beta) to show performance improvements. It eliminates an indirection and associated memory allocations. In particular, changes to the first element of the doubly linked list (e.g. the frequently used insert_first) will now need one less allocation. Only the first function is slower now, which is likely insufficient reason not to use the patch.

I don't have a comprehensive benchmark suite (you probably do), but in some simple tests (e.g. insert_first of a lot of elements + removal of each inserted element), the performance gain was around 2.5% and allocated words were reduced by about 10%.

The speed improvement isn't overwhelming, mostly because the OCaml runtime is so crazy good at small allocations. But a reduction in allocated words will reduce GC pressure and possible latencies associated with more frequent collections.

@yminsky
Copy link
Copy Markdown

yminsky commented Oct 13, 2016

See comment on #59

@hhugo
Copy link
Copy Markdown

hhugo commented Jan 7, 2018

@mmottl, would you mind rebasing you PR ?

@mmottl mmottl force-pushed the doubly-linked-gadt branch from 012dd8b to f752279 Compare January 7, 2018 18:47
@mmottl
Copy link
Copy Markdown
Author

mmottl commented Jan 7, 2018

@hhugo No problem, it's rebased now.

@hhugo hhugo self-assigned this Jan 24, 2018
@yminsky
Copy link
Copy Markdown

yminsky commented Oct 10, 2020

This seems like a totally sensible improvement. Is there any reason why we haven't imported this feature?

@yminsky
Copy link
Copy Markdown

yminsky commented Oct 10, 2020

CC @bcc32 @rnml @ceastlund

@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Nov 11, 2020
@hhugo hhugo removed their assignment Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants