# \#performance

**URL:** https://discuss.ocaml.org/tag/performance/92.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Learnings from benchmarking OxCaml-flavoured SWAR memchr](https://discuss.ocaml.org/t/learnings-from-benchmarking-oxcaml-flavoured-swar-memchr/18411)

<div class="topic-metadata">

**Author:** [@KiChjang](https://discuss.ocaml.org/u/KiChjang)\
**Replies:** 9\
**Last updated:** [August 4, 2026, 10:04pm UTC](https://discuss.ocaml.org/t/learnings-from-benchmarking-oxcaml-flavoured-swar-memchr/18411 "2026-08-04T22:04:20Z")

</div>

Hi everyone, just wanted to share a benchmarking project that I had created over the past few days for testing out OxCaml: I come from 10+ years of Rust, started hacking on it when it still had the Ruby-inspired closu…

---

## [Announcing Pyro Caml: A Continuous Profiler for OCaml](https://discuss.ocaml.org/t/announcing-pyro-caml-a-continuous-profiler-for-ocaml/18217)

<div class="topic-metadata">

**Author:** [@ajbt200128](https://discuss.ocaml.org/u/ajbt200128)\
**Replies:** 0\
**Last updated:** [June 3, 2026, 4:58pm UTC](https://discuss.ocaml.org/t/announcing-pyro-caml-a-continuous-profiler-for-ocaml/18217 "2026-06-03T16:58:11Z")

</div>

Hey y’all, last year I gave a workshop on observability at Fun OCaml, and a few folks asked me what was available for continuous profiling, and I wasn’t aware of any solutions that supported OCaml directly. Since then I…

---

## [Stack vs List Performance](https://discuss.ocaml.org/t/stack-vs-list-performance/17875)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 8\
**Last updated:** [May 8, 2026, 1:31pm UTC](https://discuss.ocaml.org/t/stack-vs-list-performance/17875 "2026-05-08T13:31:32Z")

</div>

I found this exercise in a data structures and algorithms textbook/interview prep book. The idea of the exercises is that towers\_of\_hanoi should take a natural number n and return the sequence of moves that is appropria…

---

## [\[ANN\] valkey: modern Valkey client for OCaml 5 + Eio, on opam](https://discuss.ocaml.org/t/ann-valkey-modern-valkey-client-for-ocaml-5-eio-on-opam/18010)

<div class="topic-metadata">

**Author:** [@avifenesh](https://discuss.ocaml.org/u/avifenesh)\
**Replies:** 4\
**Last updated:** [April 24, 2026, 1:16am UTC](https://discuss.ocaml.org/t/ann-valkey-modern-valkey-client-for-ocaml-5-eio-on-opam/18010 "2026-04-24T01:16:00Z")

</div>

Hi everyone, I wanted to share that valkey 0.2.0 is now on opam: opam: opam - valkey.0.2.0 Repo and Getting Started: ocaml-valkey/docs/getting-started.md at main · avifenesh/ocaml-valkey · GitHub The main thing I wan…

---

## [Tyxml performance](https://discuss.ocaml.org/t/tyxml-performance/16776)

<div class="topic-metadata">

**Author:** [@katel0k](https://discuss.ocaml.org/u/katel0k)\
**Replies:** 6\
**Last updated:** [July 23, 2025, 3:41pm UTC](https://discuss.ocaml.org/t/tyxml-performance/16776 "2025-07-23T15:41:14Z")

</div>

Hello! I’m writing my diploma, where I’m profiling and comparing different solutions for templating HTML. My eye fell on tyxml, and I have found an interesting quirk. Simple benchmark for generating lots of more or less …

---

## [Returning large tuples vs records](https://discuss.ocaml.org/t/returning-large-tuples-vs-records/16756)

<div class="topic-metadata">

**Author:** [@bluddy](https://discuss.ocaml.org/u/bluddy)\
**Replies:** 5\
**Last updated:** [June 4, 2025, 2:51pm UTC](https://discuss.ocaml.org/t/returning-large-tuples-vs-records/16756 "2025-06-04T14:51:59Z")

</div>

In my Railroad Tycoon implementation, I have a function call tree that’s quite heavy: I loop over every train, updating each one (position is updated mutably for performance), and some trains will be entering important d…

---

## [Help with Jane street extension performance](https://discuss.ocaml.org/t/help-with-jane-street-extension-performance/15643)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 0\
**Last updated:** [November 21, 2024, 5:05am UTC](https://discuss.ocaml.org/t/help-with-jane-street-extension-performance/15643 "2024-11-21T05:05:26Z")

</div>

I am trying to understand how to use the unboxing and local features from the Jane Street fork to get more performant code. This is from the link here: Jane Street OCaml extensions When I benchmark this, the first functi…

---

## [How to inline this function call so it behaves the same](https://discuss.ocaml.org/t/how-to-inline-this-function-call-so-it-behaves-the-same/15479)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 1\
**Last updated:** [October 21, 2024, 8:55am UTC](https://discuss.ocaml.org/t/how-to-inline-this-function-call-so-it-behaves-the-same/15479 "2024-10-21T08:55:51Z")

</div>

I am not familiar with the use of flambda, so perhaps I have just overlooked this in the documentation. This code is from Oleg Kiselyov’s essay on modularity, “Lightweight static guarantees” (well, a minimized version of…

---

## [Compact, memory-contiguous data structures](https://discuss.ocaml.org/t/compact-memory-contiguous-data-structures/13275)

<div class="topic-metadata">

**Author:** [@UnixJunkie](https://discuss.ocaml.org/u/UnixJunkie)\
**Replies:** 4\
**Last updated:** [September 23, 2024, 10:12pm UTC](https://discuss.ocaml.org/t/compact-memory-contiguous-data-structures/13275 "2024-09-23T22:12:36Z")

</div>

Sometimes, I wonder if many functional data structures used in OCaml could not have a \[compact\] method (lists, sets, maps, etc). This method would encode the data-structure in a contiguous memory region, so that the d…

---

## [OCaml 5 performance](https://discuss.ocaml.org/t/ocaml-5-performance/15014)

<div class="topic-metadata">

**Author:** [@talex5](https://discuss.ocaml.org/u/talex5)\
**Replies:** 30\
**Last updated:** [September 11, 2024, 1:06pm UTC](https://discuss.ocaml.org/t/ocaml-5-performance/15014 "2024-09-11T13:06:52Z")

</div>

I’ve been trying out some tools to investigate performance problems in my OCaml programs and I’ve written up my experiences here in case other people find it useful: OCaml 5 performance problems - Thomas Leonard's blog …

---

## [Factoring code results in a 500% performance hit](https://discuss.ocaml.org/t/factoring-code-results-in-a-500-performance-hit/15216)

<div class="topic-metadata">

**Author:** [@adrien](https://discuss.ocaml.org/u/adrien)\
**Replies:** 6\
**Last updated:** [September 6, 2024, 9:20am UTC](https://discuss.ocaml.org/t/factoring-code-results-in-a-500-performance-hit/15216 "2024-09-06T09:20:43Z")

</div>

Hi, I’ve been working on a file sorter for better compression in archives. It orders files by similarity; a component in the similarity computation of two files is akin to a first stage of compressing them together. I’v…

---

## [Array.map vs List.map performance](https://discuss.ocaml.org/t/array-map-vs-list-map-performance/14536)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 6\
**Last updated:** [May 14, 2024, 1:45am UTC](https://discuss.ocaml.org/t/array-map-vs-list-map-performance/14536 "2024-05-14T01:45:59Z")

</div>

All other things being equal, would you expect Array.map or List.map to be faster, given that the arguments have the same number of elements n? As far as I can tell, this should be equivalent to “Is it faster to allocat…

---

## [Bounds checks for String and Bytes when retrieving (or setting) subparts thereof](https://discuss.ocaml.org/t/bounds-checks-for-string-and-bytes-when-retrieving-or-setting-subparts-thereof/14422)

<div class="topic-metadata">

**Author:** [@hannes](https://discuss.ocaml.org/u/hannes)\
**Replies:** 8\
**Last updated:** [April 12, 2024, 2:37pm UTC](https://discuss.ocaml.org/t/bounds-checks-for-string-and-bytes-when-retrieving-or-setting-subparts-thereof/14422 "2024-04-12T14:37:23Z")

</div>

Dear all, I sometimes have binary data that I need to decode. Code is normally roughly: let guard p e = if p then Ok () else Error e let ( let\* ) = Result.bind let decode\_header str = let\* () = guard (String.length…

---

## [How to optimize the memory consumption in OCaml?](https://discuss.ocaml.org/t/how-to-optimize-the-memory-consumption-in-ocaml/14391)

<div class="topic-metadata">

**Author:** [@MiK](https://discuss.ocaml.org/u/MiK)\
**Replies:** 8\
**Last updated:** [April 1, 2024, 4:42am UTC](https://discuss.ocaml.org/t/how-to-optimize-the-memory-consumption-in-ocaml/14391 "2024-04-01T04:42:54Z")

</div>

Hi everyone, I have started to learn Ocaml a few weeks ago and I have made this little project . It’s a kind of “dataframe” library exposing a data structure to store heterogeneous collection of data organized by series…

---

## [Any suggestions on making this piece of OCaml numerical code more efficient?](https://discuss.ocaml.org/t/any-suggestions-on-making-this-piece-of-ocaml-numerical-code-more-efficient/14123)

<div class="topic-metadata">

**Author:** [@UnixJunkie](https://discuss.ocaml.org/u/UnixJunkie)\
**Replies:** 28\
**Last updated:** [February 27, 2024, 1:49am UTC](https://discuss.ocaml.org/t/any-suggestions-on-making-this-piece-of-ocaml-numerical-code-more-efficient/14123 "2024-02-27T01:49:41Z")

</div>

Dear OCaml hackers, I have this little piece of code whose performance is critical. If you have some ideas on how to accelerate it, you are very welcome. If people are interested, I can create a small repository where…

---

## [Excluding the runtime from performance measurements](https://discuss.ocaml.org/t/excluding-the-runtime-from-performance-measurements/13637)

<div class="topic-metadata">

**Author:** [@rlepigre](https://discuss.ocaml.org/u/rlepigre)\
**Replies:** 0\
**Last updated:** [December 14, 2023, 1:30pm UTC](https://discuss.ocaml.org/t/excluding-the-runtime-from-performance-measurements/13637 "2023-12-14T13:30:47Z")

</div>

As a bit of context, I recently added instruction counting support to Coq using the Linux perf API, and then starting playing around with a tool to visualize the impact of changes (e.g., to Coq or to Coq plugins) on the …

---

## [Manual CPS is faster than CPS monad. Is it expected?](https://discuss.ocaml.org/t/manual-cps-is-faster-than-cps-monad-is-it-expected/13560)

<div class="topic-metadata">

**Author:** [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Replies:** 6\
**Last updated:** [December 3, 2023, 5:13pm UTC](https://discuss.ocaml.org/t/manual-cps-is-faster-than-cps-monad-is-it-expected/13560 "2023-12-03T17:13:54Z")

</div>

I was experimenting with monads, and discovered that CPS monad performs slower than manual CPS transformation. It seems the case for OCaml, Racket and Chicken Scheme. In OCaml the difference can be 2-3x. In GHC they per…

---

## [Unexpected poor performance of comparison loops](https://discuss.ocaml.org/t/unexpected-poor-performance-of-comparison-loops/12745)

<div class="topic-metadata">

**Author:** [@VPhantom](https://discuss.ocaml.org/u/VPhantom)\
**Replies:** 3\
**Last updated:** [August 2, 2023, 2:56pm UTC](https://discuss.ocaml.org/t/unexpected-poor-performance-of-comparison-loops/12745 "2023-08-02T14:56:41Z")

</div>

Hi! In my venture to create a few operations on slices of bytes, I have met surprising performance when working on a sliced equivalent to Bytes.equal. That is, a hypothetical Bytes.equal\_slice a a\_pos b b\_pos len: ┌───…

---

## [\[ANN\] Sandmark nightly now supports latency profiling](https://discuss.ocaml.org/t/ann-sandmark-nightly-now-supports-latency-profiling/12318)

<div class="topic-metadata">

**Author:** [@punchagan](https://discuss.ocaml.org/u/punchagan)\
**Replies:** 2\
**Last updated:** [June 5, 2023, 3:27am UTC](https://discuss.ocaml.org/t/ann-sandmark-nightly-now-supports-latency-profiling/12318 "2023-06-05T03:27:09Z")

</div>

Sandmark nightly now monitors tail latency of sequential and parallel applications enabled by new features in OCaml 5. Click to see the Sequential latency benchmark run Click here to see the Parallel latency benc…

---

## [Tail recursive loops and closures](https://discuss.ocaml.org/t/tail-recursive-loops-and-closures/10845)

<div class="topic-metadata">

**Author:** [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Replies:** 3\
**Last updated:** [November 22, 2022, 5:05pm UTC](https://discuss.ocaml.org/t/tail-recursive-loops-and-closures/10845 "2022-11-22T17:05:29Z")

</div>

When you are writing inner loops as tail-recursive functions I’d like to know if there’s a performance advantage in passing the arguments you are accessing to the loop function itself. For example write: let find\_cha…

---

## [Sandmark Nightly Service now reports Instructions Retired along with Time](https://discuss.ocaml.org/t/sandmark-nightly-service-now-reports-instructions-retired-along-with-time/10475)

<div class="topic-metadata">

**Author:** [@shakthimaan](https://discuss.ocaml.org/u/shakthimaan)\
**Replies:** 0\
**Last updated:** [September 14, 2022, 6:49am UTC](https://discuss.ocaml.org/t/sandmark-nightly-service-now-reports-instructions-retired-along-with-time/10475 "2022-09-14T06:49:48Z")

</div>

Sandmark Nightly is a service for the OCaml compiler developers that helps benchmark the development branches of the compiler on the large set of Sandmark benchmarks on tuned machines and reports the results in an intera…

---

## [\[ANN\] Sandmark Nightly - Benchmarking as a Service](https://discuss.ocaml.org/t/ann-sandmark-nightly-benchmarking-as-a-service/10174)

<div class="topic-metadata">

**Author:** [@shakthimaan](https://discuss.ocaml.org/u/shakthimaan)\
**Replies:** 11\
**Last updated:** [July 21, 2022, 9:16am UTC](https://discuss.ocaml.org/t/ann-sandmark-nightly-benchmarking-as-a-service/10174 "2022-07-21T09:16:12Z")

</div>

Tarides is happy to announce Sandmark Nightly benchmarking as a service. tl;dr OCaml compiler developers can now point development branches at the service and get sequential and parallel benchmark results at https://sand…

---

## [Styles in defining functions](https://discuss.ocaml.org/t/styles-in-defining-functions/9983)

<div class="topic-metadata">

**Author:** [@zhtprog](https://discuss.ocaml.org/u/zhtprog)\
**Replies:** 3\
**Last updated:** [June 7, 2022, 11:34am UTC](https://discuss.ocaml.org/t/styles-in-defining-functions/9983 "2022-06-07T11:34:33Z")

</div>

I noticed a style of defining top functions without its arguments, as in: let f = let aux1 = ... in let aux2 ... = ... in (\* now really define the function \*) let f x y z = ... in f This way aux values are d…

---

## [Blog post: Js\_of\_ocaml, a bundle size study](https://discuss.ocaml.org/t/blog-post-js-of-ocaml-a-bundle-size-study/9211)

<div class="topic-metadata">

**Author:** [@jchavarri](https://discuss.ocaml.org/u/jchavarri)\
**Replies:** 16\
**Last updated:** [April 23, 2022, 7:19am UTC](https://discuss.ocaml.org/t/blog-post-js-of-ocaml-a-bundle-size-study/9211 "2022-04-23T07:19:18Z")

</div>

Hi all, I hope your Monday is going great. :slight\_smile: I wanted to analyze bundle size performance in Js\_of\_ocaml, so I rewrote an existing ReScript web app to compare both outputs. Here is the blog post with all th…

---

## [Local functions and performance](https://discuss.ocaml.org/t/local-functions-and-performance/9644)

<div class="topic-metadata">

**Author:** [@threepwood](https://discuss.ocaml.org/u/threepwood)\
**Replies:** 6\
**Last updated:** [April 11, 2022, 8:07am UTC](https://discuss.ocaml.org/t/local-functions-and-performance/9644 "2022-04-11T08:07:52Z")

</div>

Very basic question: is there a perfomance cost to the below idiom where a non-public recursive function implementing a loop / traversal of some kind takes some of its arguments from the context rather than explicitly? O…

---

## [Best practice for performant string operation?](https://discuss.ocaml.org/t/best-practice-for-performant-string-operation/9345)

<div class="topic-metadata">

**Author:** [@bn-d](https://discuss.ocaml.org/u/bn-d)\
**Replies:** 8\
**Last updated:** [February 17, 2022, 9:48pm UTC](https://discuss.ocaml.org/t/best-practice-for-performant-string-operation/9345 "2022-02-17T21:48:57Z")

</div>

I recently received this comment (thanks!) for a package I published. It is honestly something I never think of before. str\_1 ^ str\_2 ^ str\_3 ^ str\_4 ^ str\_5 This code seems innocent and clean. But if you look at ^ u…

---

## [OCaml benchmarks on different processor architectures?](https://discuss.ocaml.org/t/ocaml-benchmarks-on-different-processor-architectures/8802)

<div class="topic-metadata">

**Author:** [@ejgallego](https://discuss.ocaml.org/u/ejgallego)\
**Replies:** 0\
**Last updated:** [November 12, 2021, 4:37pm UTC](https://discuss.ocaml.org/t/ocaml-benchmarks-on-different-processor-architectures/8802 "2021-11-12T16:37:00Z")

</div>

Hi all, as many of you may know, we live in interesting time regarding CPU vendor competition, with Intel, AMD, and Apple trading wins over very different benchmarks. I couldn’t however find a benchmark / review that c…

---

## [Representing data more compactly but unsafely](https://discuss.ocaml.org/t/representing-data-more-compactly-but-unsafely/8489)

<div class="topic-metadata">

**Author:** [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Replies:** 13\
**Last updated:** [September 16, 2021, 3:17pm UTC](https://discuss.ocaml.org/t/representing-data-more-compactly-but-unsafely/8489 "2021-09-16T15:17:12Z")

</div>

I’m collecting cases where people modernized data representation either to store them more compactly or to store some extra data in unused bytes. If it is done using unsafe features of OCaml (or similar language runtime…

---

## [Performance difference between bigarray inside record and plain bigarray access](https://discuss.ocaml.org/t/performance-difference-between-bigarray-inside-record-and-plain-bigarray-access/8300)

<div class="topic-metadata">

**Author:** [@eWert-Online](https://discuss.ocaml.org/u/eWert-Online)\
**Replies:** 8\
**Last updated:** [August 16, 2021, 4:20am UTC](https://discuss.ocaml.org/t/performance-difference-between-bigarray-inside-record-and-plain-bigarray-access/8300 "2021-08-16T04:20:31Z")

</div>

Hello :wave: today I noticed a behavior I don’t have an explanation for. Maybe some of you can explain, why this happens. :slightly\_smiling\_face: Using the following code, the Io implementation where the bigarray is p…

---

## [High-performance lexing in OCaml](https://discuss.ocaml.org/t/high-performance-lexing-in-ocaml/7552)

<div class="topic-metadata">

**Author:** [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Replies:** 20\
**Last updated:** [April 1, 2021, 7:09pm UTC](https://discuss.ocaml.org/t/high-performance-lexing-in-ocaml/7552 "2021-04-01T19:09:25Z")

</div>

I’m in the process of writing parser for a YAML-like language, that extends JSON, and is specified in two layers: a lexical layer, and a grammatical layer. The current implementation uses sedlex + camlp5 extensible gram…

[Next page](https://discuss.ocaml.org/tag/performance/92.md?match_all_tags=true&page=1&tags%5B%5D=performance)
