Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consequences of missing dict smart pointer #7

Open
sebres opened this issue Aug 31, 2017 · 0 comments
Open

Consequences of missing dict smart pointer #7

sebres opened this issue Aug 31, 2017 · 0 comments
Labels

Comments

@sebres
Copy link
Owner

sebres commented Aug 31, 2017

Because the dict-primitives are not public available (for usage in module), I've simulated the smart dict reference with simple duplication (to guarantee single reference of the object, to get alterable dict collection).

This workaround has following consequences:

  • Certain objects "leakage", because each format-object (no matter localized format or not) will be stored in ::tcl::clock::LocaleFormats cache. This is very annoying especially if many dynamically formats are used;
  • Certain performance degradation (for above-mentioned reason with localization of each format and duplication instead of smart-ref);
  • Not optimal usage of internal cache structures by date-time conversion with fast switch of locale / formats;
  • also the internal GC for the formats is not really usable (because all objects are still referenced in LocaleFormats).

All that is a reason enough to re-implement a "technical" dict smart pointer in tclclockmod, similar to clock-speedup branch in the fossil-repo of tcl-core.

The code example to reproduce a "leak" using simple dynamic clock-format:

time {
  clock format 0 -format "[expr {int(rand()*10000)}] %a %b, %x-%X" \
    -locale [lindex {en de fr} [expr {int(rand()*3)}]]
} 100000

BTW. Please note that the amount of the "leakage" of default clock ensemble is many times larger in this case (because of the format-caching).

Engine Memory usage (x86) Memory usage (x64)
tcl8.6-clock ca. 130MB ca. 170MB
tclclockmod ca. 20MB ca. 50MB

But nevertheless I see the necessity to "fix" it in tclclockmod.

@sebres sebres added the wip label Oct 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant