svd2rust icon indicating copy to clipboard operation
svd2rust copied to clipboard

Modules (`form`)

Open burrbull opened this issue 4 years ago • 6 comments

Closes #424 .

r? @therealprof

Speed tests are needed

burrbull avatar Jan 14 '20 07:01 burrbull

That's very nice! Need to have a closer look this evening.

therealprof avatar Jan 14 '20 08:01 therealprof

@therealprof you promised to look

burrbull avatar Feb 16 '20 11:02 burrbull

Didn't get to it, sorry. Maybe I can squeeze it in later today.

therealprof avatar Feb 16 '20 11:02 therealprof

I had a look. svd2rust runtime goes through the roof with the -foption, it takes 10x as long in my tests to dump the code. There's no change in build/check times of the generated code.

It would be great to see some noticeable benefit somewhere.

therealprof avatar Feb 16 '20 17:02 therealprof

The Module is a rather weird implementation causing quite a few clippy lints and warnings in case the superfluous #[allow(dead_code)] are removed.

We should also get rid of all the panics and instead implement proper error handling.

therealprof avatar Feb 16 '20 17:02 therealprof

Any plan on this?

Recently I tried the logic of xtask in esp-pacs on d1-pac, which first generates lib.rs and then transforms it into modules in src. Much simpler than this implementation in my mind. esp-pacs d1-pac

it takes 10x as long in my tests to dump the code.

I am not familiar with improving performance. Taking a simple look at the flame graph of executing xtask gen d1, I found that form::create_directory_structure is indeed costly. But I don't feel it annoying since I always use form after generating code with svd2rust.

The flame graph: flamegraph

duskmoon314 avatar Oct 19 '22 04:10 duskmoon314