aclysma / profiling

Provides a very thin abstraction over instrumented profiling crates like puffin, optick, tracy, and superluminal-perf.
Apache License 2.0
324 stars 41 forks source link

std is been pulled as dependecy, even without any backends #47

Closed lassade closed 1 year ago

lassade commented 1 year ago

profiling = "1.0.7" with no extra features can't be built with:

cargo build -r --target=x86_64-pc-windows-msvc -Z build-std=core,compiler_builtins,alloc,panic_abort

I something like profiling::scope!("sort"); shouldn't be generating any code at all but for some reason the compiles keeps liking std any ideas why?

aclysma commented 1 year ago

I think no_std has to be opted into with #![no_std]. It controls linking so I could see it only need to be used in the binary crate but I have little experience with it. Does it need to be present in all dependencies? May be worth checking with cargo tree that there aren’t any dependencies or dev-dependencies being brought in?

lassade commented 1 year ago

Nop there is no other std dependency.

This is happening because profiling doesn't have a #![no_std] so even though no code is been generated from the macros the std is still pulled into the dependency. That doesn't show on cargo tree :)

It is possible this crate to no_std maybe supporting only a couple of backends?

aclysma commented 1 year ago

I don’t mind having this crate opt into no_std for when no backend is enabled or if there is a backend that doesn’t need std. I don’t know if any of the backends would support it though. If you want to PR something related to this I’d be happy to look! I’m not currently using rust on platforms that don’t have std so I’m not sure if/when I would find time to do this myself.

aclysma commented 1 year ago

Completed in #49