texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] General efficiency of TeXmacs


From: Joris van der Hoeven
Subject: Re: [Texmacs-dev] General efficiency of TeXmacs
Date: Sun, 14 Jun 2009 20:33:26 +0200
User-agent: Mutt/1.5.9i

On Sun, Jun 14, 2009 at 05:11:23PM +0100, Norbert Nemec wrote:
> a) For the central data types (string, tree, etc), nearly all routines 
> should be defined as "inline" in the header files. The cleanest and 
> simplest solution that I see would be to introduce additional files like 
> string.inc.hpp that contain many of the routines that are currently 
> defined in string.cpp and include this at the end of string.hpp. That 
> way, the header file would not become cluttered, but the compiler could 
> still do heavy inlining on these routines.

Maybe.

> b) Profiling indicates that the program spends a tremendous amount of 
> time on reference counting and deallocation. Moving to a garbage 
> collector would significantly simplify the code and should result in 
> quite some speedup. Especially for interactive programs, garbage 
> collection is the fastest memory management strategy available since all 
> the collecting is simply happening in idle time and the time critical 
> code does not need to worry about deallocation at all.

David did expermiments with that, but did not notice any important speedup.
In addition, garbage collectors such as Boehm GC have other disadvantages.
If we want to reduce the time spent on reference counting,
then we should rather switch to const references, as said before.

> c) The string class is a significant bottleneck. Every time a (char*) is 
> converted, the data is copied to a newly allocated location. In most 
> cases, this could be avoided by simply copying a pointer. This would 
> mean that the string_rep class would need to carry a flag on whether the 
> space is "owned" (and should be deallocated) or just "borrowed". I 
> certainly is a non-trivial task to sort this out, but I believe it would 
> be the single-most-rewarding detail in optimizing for performance.

One possibility I see is to replace all strings by global variables.
However, as Max noticed, this introduces other problems. The C++ compiler
sucks on this point; we had a similar problem in mathemagix.
The only clean solution, a more systematic use of static variables,
also introduces overhead (tests are inserted by the compiler
for knowing whether a variables is used for the first time).

Best wishes, Joris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]