cpptcl icon indicating copy to clipboard operation
cpptcl copied to clipboard

prototype

Open bunker-bunk567 opened this issue 4 years ago • 11 comments

Hi there,

i did some work on cpptcl. let me know if you are interested.

  • c++ variadic templates, remove a lot of boilerplate code
  • remove a couple of map lookups for each function call (400% faster calls)
  • tie Tcl channels to std::iostreams

bunker-bunk567 avatar Sep 24 '21 19:09 bunker-bunk567

nobody interested in free quality code?

bunker-bunk567 avatar Oct 27 '21 02:10 bunker-bunk567

You'll need to fix the cmake problem

bovine avatar Oct 27 '21 04:10 bovine

I haven't tried it, but you might need to add some directives like:

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

bovine avatar Oct 28 '21 16:10 bovine

i will figure it out. busy elsewhere currently.

bunker-bunk567 avatar Oct 28 '21 20:10 bunker-bunk567

You should be able to verify the build in your own repo if you go to https://github.com/bunker-bunk567/cpptcl/actions and enable the actions

bovine avatar Nov 04 '21 22:11 bovine

are there any open applications that use cpptcl? i am fairly sure my version is no longer compatible and the test cases don't cover those discrepancies.

bunker-bunk567 avatar Nov 05 '21 02:11 bunker-bunk567

I'm not aware of any published ones, but FlightAware internally uses cpptcl extensively and if there is API breakage then that will likely be a very significant hurdle.

bovine avatar Nov 05 '21 22:11 bovine

i think we might be going different ways then. unless someone is interested at your end to change the way of doing business i see no point trying to remain compatible.

if you have future plans for TCL, you have an opportunity to improve the quality of future code.

there is still the issue of the extra std::map lookup for the policy object at each function call, which is a big unnecessary heat generator. if you move the policy object into the callback object, you can get 5 times faster function calls (backwards compatible). also you can omit some other std::map lookups for the callback object itself if you make use of TCL's ClientData mechanism.

another issue is that cpptcl object() does not properly implement sharing and takes no advantage of TCL object sharing (creating and duplicating more than would be necessary). but that is likely going to cause some breakage.

bunker-bunk567 avatar Nov 05 '21 23:11 bunker-bunk567

I would not rule out accommodating some changes, since this seems like a big advance in the way templates are used. We can't pull it immediately into master, but if it were merged into a branch we could migrate to it.

resuna avatar Nov 06 '21 00:11 resuna

we can just leave open this pull request without intending to merge it anywhere until we change our minds about it.

i am primarily interested in improving openboardview using cpptcl as a building block, but if somebody wants to work with me on something else, they can come here.

if you point me to an application that is not too large i would see if i can improve backwards compatibility myself. it would probably end up somewhere in the middle: backwards compatible with the style, but requiring some modifications due to technical limitations. or more precisely: it would make sense to be not 100% backwards compatible.

bunker-bunk567 avatar Nov 06 '21 01:11 bunker-bunk567

Perhaps splitting this PR into multiple smaller ones that are individually less disruptive to existing users would be an option?

bovine avatar Nov 09 '21 21:11 bovine