Hello Hello.
I have an application in which I need to compiled a huge number of programs of different sizes, and then execute each one of them on a large dataset. Also note that the programs change rapidly, so each time I should compile them again.
Currently, I do:
- Compile each program using cranelift, so I have a
CompiledCode
- Allocate a memory mapped region
- Copy the bytes of compiled code from buffer of
CompiledCode to the memory mapped allocation
- Make the memmap executable
- Transmute the memmap into a function
- Execute the function on the dataset
Typically, there are 1k-10k programs. And memset has become a very big bottleneck in performance.
What I need to do, is allocate a memmap, and then ask cranelift to write bytes on that region. There is compile_and_emit. But it has got two problems, first you are deprecating this method. Second, this wants a Vec<u8> instead of &mut [u8].
The immediate solution to me as an outsider seems keeping the method and changing it to accept a slice instead of a vec. The right solution, I don't know :)
Hello Hello.
I have an application in which I need to compiled a huge number of programs of different sizes, and then execute each one of them on a large dataset. Also note that the programs change rapidly, so each time I should compile them again.
Currently, I do:
CompiledCodeCompiledCodeto the memory mapped allocationTypically, there are 1k-10k programs. And
memsethas become a very big bottleneck in performance.What I need to do, is allocate a memmap, and then ask cranelift to write bytes on that region. There is
compile_and_emit. But it has got two problems, first you are deprecating this method. Second, this wants aVec<u8>instead of&mut [u8].The immediate solution to me as an outsider seems keeping the method and changing it to accept a slice instead of a vec. The right solution, I don't know :)