Is it possible to redistribute GC GC OCaml?

There is no realloc in OCaml memory.h or alloc.h (byterun / caml). Does this mean that it is not possible to redistribute the OCaml GC block (or value)? The use case I think of is a concat line where the following can be optimized using realloc:

a = a ^ b

In my tests, the concat string actually works faster in PHP (5.5) than the compiled OCaml (4.02.1).

Change . In another test, it’s Buffermuch faster than PHP concat, and still faster than OCaml concat even when converting a buffer to a string in each iteration of the loop. Code .

+4
source share
1 answer

, realloc() -style OCaml.

realloc() ; . , , .

OCaml ; GC ; . . , .

, realloc() OCaml GC.

, realloc() - , PHP, OCaml. , -, . , , , .

, OCaml Buffer, . , , , ^ ( ).

+3

Source: https://habr.com/ru/post/1607731/


All Articles