Thread overview | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 02, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 Mike <slavo5150@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |bare-metal -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 Dmitry Olshansky <dmitry.olsh@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmitry.olsh@gmail.com --- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> --- > I have modeled these statically with D's fantastic modelling features to produce an object-oriented, easily-navigable hierarchy of the hardware memory map (example: https://github.com/JinShil/stm32f42_discovery_demo/blob/master/source/stm32f42/gpio.d). It is an excellent model that generates fast code and plays very well with tooling. The only problem is the TypeInfo bloat. I'd just go for structs + template mixins for inheritance. It's not like you do any of virtual calls/typeinfo/object factory/whatever. mixin template Register(blah...){ } struct Peripheral{ mixin Register!(x,y,z,...); mixin Register!(q,w,e,...); } Makes any sesne? -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #2 from Mike <slavo5150@yahoo.com> --- (In reply to Dmitry Olshansky from comment #1) > I'd just go for structs + template mixins for inheritance. It's not like you do any of virtual calls/typeinfo/object factory/whatever. > > mixin template Register(blah...){ } > > struct Peripheral{ > > mixin Register!(x,y,z,...); > mixin Register!(q,w,e,...); > > } > > Makes any sesne? Yes, it makes sense, but it is not my preference, and is beside the point of this issue. Furthermore, with your suggestions, you will still have a new type for each peripheral, and therefore unwanted TypeInfo bloat for each and every one of those peripherals. The compiler/linker should generate efficient code using my pattern, and I shouldn't have to compromise. Nor should I have to add stubs for runtime features that have no hope of every being used. Rust does a good job with this, and I don't see why I should have to lower my expectations for D. -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #3 from Sobirari Muhomori <dfj1esp02@sneakemail.com> --- I have an impression that LDC doesn't generate TypeInfo for structs for me (because when it does, linking fails), if I don't use array comparisons and disable opEquals. The Rust argument is valid though :) -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #4 from Dmitry Olshansky <dmitry.olsh@gmail.com> --- (In reply to Sobirari Muhomori from comment #3) > I have an impression that LDC doesn't generate TypeInfo for structs for me (because when it does, linking fails), if I don't use array comparisons and disable opEquals. The Rust argument is valid though :) I also was under an impression that only classes do have obligatory type-info everything else is generated on demand. -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #5 from Sobirari Muhomori <dfj1esp02@sneakemail.com> --- And compile with -O2 or -Os -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #6 from Mike <slavo5150@yahoo.com> --- (In reply to Sobirari Muhomori from comment #5) > And compile with -O2 or -Os Doesn't work. See http://forum.dlang.org/post/quemhwpgijwmqtpxukiv@forum.dlang.org -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #7 from Dmitry Olshansky <dmitry.olsh@gmail.com> --- (In reply to Mike from comment #6) > (In reply to Sobirari Muhomori from comment #5) > > And compile with -O2 or -Os > > Doesn't work. See http://forum.dlang.org/post/quemhwpgijwmqtpxukiv@forum.dlang.org Yes, but try without classes. -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 --- Comment #8 from Sobirari Muhomori <dfj1esp02@sneakemail.com> --- I mean -O0 leaves all junk intact, so at least with LDC -Os is required for successful linking (or maybe it was required before I wrote needed druntime functions? will see). I didn't try to use classes yet (wonder what I would do when I need polymorphism). -- |
August 20, 2015 [Issue 14758] TypeInfo causes excessive binary bloat | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14758 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |performance CC| |bugzilla@digitalmars.com --- Comment #9 from Walter Bright <bugzilla@digitalmars.com> --- Partial fix: https://github.com/D-Programming-Language/dmd/pull/4912 -- |
Copyright © 1999-2021 by the D Language Foundation