IDL gen improvements 3 - Fold all proc-macro code back into rs-matter-macros#239
Conversation
rs-matter-macros
191f046 to
07000cd
Compare
|
@bjoernQ What do you think about this one? I'm unsure how to proceed.
In any case, my feeling is three proc-macro-related crates is a bit too many, so either everything back into What is your feeling? |
|
I probably need to think about this a bit more - so just my initial thoughts here. My gut feeling is that having all the proc-macro code in just one crate is nicer for everyone. (Not sure how much users would really care but it's at least easier in terms of maintainence) I recently learnt about https://crates.io/crates/trybuild - I haven't used it yet, but it looks quite interesting and might be something to consider here? |
Let me spend some time with that crate. |
a9e4512 to
eb2a814
Compare
eb2a814 to
435c808
Compare
rs-matter-macrosrs-matter-macros
|
@bjoernQ I've played with the The TL;DR is:
The IDL is always parsed as one large chunk regardless whether the person is importing a single cluster, or many clusters with a particular The codegen time is proportional to the number of imported clusters. It starts with 11ms for the simplistic OnOff cluster, and baloons to 600+ms if I include all system clusters as well as the There is not yet a timing of the time it takes Rust to compile the generated code. We can add this in future, but it would take some juggling with some extra code on top of In any case, my unscientific measurements do prove that the Rust compilation of the code generated by the |
68542fd to
2a20a25
Compare
bjoernQ
left a comment
There was a problem hiding this comment.
LGTM
Getting rid of the two additional crates is a nice step forward 👍
(NOTE: #233 and #237 need to go in first or else this PR will show an unrealistically large change-set.)This PR is addressing #236 in folding all of
rs-matter-data-model,rs-matter-data-model-implandrs-matter-macrosinto justrs-matter-macros. The original split was done because of (to my recollection) issues with tests in proc-macro crates.What works in this "folded" setup:
testsfolderWhat does not work:
The "example" which is showing how a user can use the IDL parser - without the
import!proc-macro - in their code. I don't think that would be a real use case any time soon (if ever) so I just removed thisThe benchmark. We have a single simple benchmark (in the
benchesfolder) which is benchmarking (a) the IDL parser parsing time, but is not benchmarking (b) the code-generation time, nor it is benchmarking (c) the time it takesrustcto actually compile the code generated by theimport!proc-macro (which is relatively large).I don't have a good answer (not yet at least) how to restore the existing "IDL parser timing" benchmark if we fold all code under the
rs-matter-macroscrate.But in any case, I think we need at some point a more extensive benchmark anyway, which is also timing all three aspects (parsing; code generation; time it takes rustc to compile the generated code). As I have a suspicion that the proc-macro execution time might actually be dominated by (c).