Hi,
I built HS with Visual Studio and then built a simple cui app, linking to hs_runtime.lib.
The app only calls hs_alloc_scratch and hs_scan. When I compile it as Release (with
function level linking and LTCG enabled) the resulting executable is 1.7 MB in size, which
is quite huge. Since I want to use it in kernel mode, I need to make this smaller. Are
there any compile time flags I can use to disable feature I don't need?
Regards,
Timo Kreuzer
Show replies by date
There are no compile time flags for disabling features and reducing code size like that,
although of course you could try recompiling with /Os which might sacrifice performance.
Hyperscan uses a lot of inlining and static specialisation to achieve performance, and
this is at a slight penalty to code size.
If you are thinking of running Hyperscan in the kernel, more of a concern will be stack
usage, and also the use of vector registers. I have no experience with the Windows kernel,
but on Linux and FreeBSD, care must be taken when using SSE/AVX registers in kernel code,
as they may not be saved and restored correctly.
The Hyperscan runtime doesn't have deep recursive calls, but we know that some of the
runtime code can use quite a bit of space on the stack, partly due to the inlining of
large functions. I haven't analysed the output of MSVC to see what it does to these
functions, but some patterns of use could result in more than a couple of pages of stack
space being required. So you'll need to test this carefully - unlike on FreeBSD, for
example, you don't have the option of recompiling the kernel to increase kernel stack
page sizes.
Matt.
From: Hyperscan [mailto:hyperscan-bounces@lists.01.org] On Behalf Of Timo Kreuzer
Sent: Tuesday, March 08, 2016 1:23 AM
To: hyperscan(a)lists.01.org
Subject: [Hyperscan] Size of hs_runtime
Hi,
I built HS with Visual Studio and then built a simple cui app, linking to hs_runtime.lib.
The app only calls hs_alloc_scratch and hs_scan. When I compile it as Release (with
function level linking and LTCG enabled) the resulting executable is 1.7 MB in size, which
is quite huge. Since I want to use it in kernel mode, I need to make this smaller. Are
there any compile time flags I can use to disable feature I don't need?
Regards,
Timo Kreuzer