source: tol/doc/performance/TOLCleaningDic05/changes_cleaning_tol.txt @ a2f070d

1941-docker-image-to-testdevel
Last change on this file since a2f070d was 83a1cc2, checked in by Víctor de Buen <vdebuen@…>, 18 years ago

Unified document directory

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@21 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 18.2 KB
RevLine 
[83a1cc2]1
2
3///////////////////////////////////////////////////////////////////////////
4// Proceso de limpieza de TOL previo al desarrollo de OISS
5///////////////////////////////////////////////////////////////////////////
6
7El propósito fundamental del presente proceso de limpieza de TOL es dejar una versión de TOL algo más despejada de elementos estériles y confusos así como prepararla para el desarrollo de sistemas OISS que le den una mayor agilidad y robustez a los proyectos desarrollados en TOL, de forma que dé tiempo al equipo de desarrollo a diseñar e implementar un nuevo lenguaje TOL sin bloquear por ello a los analistas de forma excesiva.
8
9En términos del código C++, el objetivo principal era más que nada disponer los templates básicos adecuados para más adelante poder instanciar objetos TOL serializables de forma indexada y probablemente utilizando memoria externa, lo cual se consigue bássicamente virtualizando los métodos principales de los objetos Name, Description, Contens, etc.; y esa ha sido mi principal labor. Sin embargo aprovechando el tirón le he dado un repasito general a TOL haciendo esa limpieza de la que tanto habíamos hablado, eliminando campos superfluos e incorporándolos eventualmente en su lugar correspondiente en la jerarquía de clases. A las clases BText y sobretodo BSet también les he dado un hachazo importante.
10
11Como efecto colateral se consigue que desaparezcan algunos errores en la recompilación, especialmente de funciones TOL de usuario, y una disminución de en torno a un 40% de la memoria usada por TOL y un pequeño aumento de la velocidad que en modo alguno alguno justificarían el trabajo hecho, el cual cobra sentido sólo por el hecho de conseguir una jerarquía de clases más limpia y potente.
12
13El principal problema de memoria se debe a que los objetos siguen sin borrarse convenientemente como deberían debido al lío que supone el tratamiento de las referencias vía BList y BSet, las cuales llevan bastante mala vida, pues se manipulan en exeso a veces, además de las llamadas directas a InNRefs y DecNRefs. He mejorado parcialmente esto devolvíéndose ahora bastante más memoria que antes por lo que en algunas ocasiones, cuando se hacen procesos repetitivos muy pesados, el ahorro de memoria puede ser brutal.
14
15Sin embargo, en el momento en el que se produzca cualquier pequeño desorden en los procesos de destrucción se empiezan a quedar objetos huérfanos de lista que les pueda ordenar destruirse y por eso pasa lo que pasa. Eso es realmente muy complicado de detectar sin tener casos de código TOL sencillo que reproduzcan y aislen los problemas por lo que no he dedicado apenas tiempo a ello aunque algo sí ha mejorado la situación. En cualquer caso es algo a lo que no merece la pena dedicarle tiempo a no ser que salte algo a la vista en cuaquier momento.
16
17Además este problema quedará salvado, o al menos paliado en gran medida, con el desarrollo de OISS, en cuanto disponga del tiempo necesario para ello.
18
19
20
21
22///////////////////////////////////////////////////////////////////////////
23//Basic objects related changes
24///////////////////////////////////////////////////////////////////////////
25bbasic/tol_batom.h :
26-virtual methods IsDeadObj and System are been downloaded from BSyntaxObject to this level to allow a best memory tracing
27
28bbasic/atm.cpp :
29-Changed memory trace handling
30
31bbasic/tol_barray.h :
32-Constant factor 2 for Add reallocation replaced by ReallocMarginFactor defined as 1.2
33
34bbasic/txt.cpp :
35-BText::defectSize_  =  0 instead of old unused value of 64, due to constant 1 was used;
36
37bbasic/tol_btext.h
38bbasic/txt.cpp
39bbasic/tol_bdir.h
40bbasic/dir.cpp
41bbasic/dirtext.cpp
42bbasic/tol_bopt.h
43bbasic/opt.cpp     
44bbasic/opttext.cpp
45bparser/par.cpp : Now BText doesn't inherites from BAtom. To insert strings in lists BObject will be used.
46
47bbasic/tol_btimer.h
48bbasic/timer.cpp : New access functions to miliseconds and string formated of process elapsed time
49
50
51///////////////////////////////////////////////////////////////////////////
52//Math objects related changes
53///////////////////////////////////////////////////////////////////////////
54bmath/bstat/stat.cpp:
55-Frequency(...) must divide in just n parts instead of n+1
56
57///////////////////////////////////////////////////////////////////////////
58//Kernel-grammar related changes
59///////////////////////////////////////////////////////////////////////////
60btol/bgrammar/tol_bstruct.h
61btol/bgrammar/str.cpp : BField inherites from BObject instead of BSyntaxObject
62
63btol/bgrammar/tol_bgrammar.h
64btol/bgrammar/graacc.cpp     : New IsAutoContens() method of grammars to be used in future
65
66btol/bgrammar/graimp.cpp
67Unparsing is used just in Evaluate(BText expression) instead of Evaluate(BTree tree) to save memory and process time.
68
69
70///////////////////////////////////////////////////////////////////////////
71//Syntax-hierarchy related changes
72///////////////////////////////////////////////////////////////////////////
73btol/bgrammar/tol_bsyntax.h
74btol/bgrammar/syn.cpp
75btol/bgrammar/tol_bgrammar.h
76btol/bgrammar/graacc.cpp
77btol/bgrammar/tol_bmethod.h
78btol/bgrammar/met.cpp         :
79-Unused class BSyntaxImage and related functions has been eliminated
80
81btol/bgrammar/tol_bsyntax.h
82btol/bgrammar/tol_bgencon.h
83btol/bgrammar/tol_bgenobj.h
84btol/lang/language.cpp        :
85-Boolean members system_, released_, calculated_, and calculating_ are compacted in a protected bit-struct flags_ member at BSyntaxObject using just a byte all together
86
87tol_bcommon.h,
88btol/bgrammar/tol_bsyntax.h
89btol/bgrammar/syn.cpp :
90-BSyntaxObject Mode constants are moved to tol_bsyntax.h
91
92btol/bgrammar/tol_bsyntax.h
93lang/language.cpp:
94-flags_.system_ is set to true for all BSyntaxObjects until TOLHasBeenInitialized() return true, when InitGrammars ends
95
96btol/bgrammar/tol_bsyntax.h
97btol/bgrammar/syn.cpp:
98-Old BSyntaxObject tolPath_ is restricted to BSetFromFile to be used in new method ParentPath() to access to path of the file where the object was created in.
99-New BSynObjOptInfo class to optional storement of name_, description_, localName_ and parent_ in BSyntaxObject just when needed
100-Changed memory trace handling
101
102btol/bgrammar/tol_bgentmp.h
103btol/bgrammar/tol_bgencon.h
104btol/bgrammar/tol_bgenobj.h
105lang/language.cpp :
106-class BRenamed is eliminated
107-BRenamedGen is renamed as BRefObject
108-In BTmpObject args_ member is now a BList* instead of a BSet and a short card_, and BSyntaxObject** array_ are used to accelerate accesses to arguments.
109-New template classes has been inserted in *Contens* template hierarchy
110  ·A new template BGraContensBase<Any> without contens_ to save memory when is this member is not needed and allowing virtual access to it
111  ·A new template BGraContensFND<Any,Name_,Description_> usefull to returned objects by built-in functions saving memory in each instance
112  ·A new temlpate BCopyContens<Any> to use instead of BRenContens<Any> to low size types as Real, Complex, Date, Text, Polyn, Ration. This objects copy the contens of referenced object and try to destroy it. If nos possible destroyer is delayed to the live end of encapsulating object
113
114btol\matrix_type\matgra.cpp
115btol\set_type\setgra.cpp
116btol\bgrammar\tol_bgentmp.h:
117-Access to BSet BTmpObject<Any>::Args() must be replaced by BList* ArgList() or DupArgList()
118
119btol\bmonte\mc-integrator.cpp
120btol\matrix_type\matgra.cpp
121btol\real_type\armseval.cpp
122btol\real_type\datgrapr.cpp
123btol\real_type\datgrast.cpp
124btol\real_type\datgrav.cpp
125btol\set_type\setgra.cpp
126btol\timeset_type\tmsgrav.cpp
127btol\bgrammar\tol_bgentmp.h:
128lang\language.cpp
129-Access to BSet BTmpObject<Any>::Args().Card() must be replaced by NumArgs()
130
131btol\bmonte\mc-integrator.cpp
132btol\cseries_type\ctsrgra.cpp
133btol\matrix_type\multimin.cpp
134btol\serie_type\tsrgra.cpp
135btol\set_type\setgra.cpp
136btol\bgrammar\tol_bgencon.h
137btol\bgrammar\tol_bgenobj.h
138btol\bgrammar\tol_bsyntax.h
139btol\set_type\tol_bsetgra.h:
140lang\language.cpp
141-Access to BSyntaxObject or inherited boolean members system_, released_, calculated_, and calculating_ must be changed to flags_.* or BSyntaxObject::Put* functions
142
143btol\matrix_type\matgra.cpp
144btol\real_type\datgra.cpp
145btol\real_type\datgsrst.cpp
146btol\text_type\txtgra.cpp
147lang\language.cpp
148-BSystem* objects that shouldn't be system constants are changed to BUser* to inherite from BGraContens<Any> instead of undeletable system class BGraConstant<Any>
149   
150 
151///////////////////////////////////////////////////////////////////////////
152//TOL Functions and Code-type related changes
153///////////////////////////////////////////////////////////////////////////
154btol/bgrammar/tol_boper.h
155btol/bgrammar/opr.cpp      :
156-New BOperator::AddSystemOperator() to control different creating processes of built-in and user functions that were never deleted internally
157
158btol/bgrammar/met.cpp :
159-New bool BuildingMethod() function to special treatment of overloading of method's functions
160
161btol/bgrammar/txthash.cpp :
162-Fixed forbidden accesses to code->Contens() for non BUSerFunction objects
163-When BuildingMethod() is false Mode() must be equal to so.Mode() to match
164
165btol/code_type/tol_bcode.h
166btol/code_type/cod.cpp      :
167-Internal BCode::operator_ is changed from BUserFunction*  to BStandardOperator*
168
169btol/code_type/tol_bcodgra.h :
170-BUserFunCode::Mode() is changed to BOBJECTMODE instead of BUSERFUNMODE that is reserved to internal operators
171-Unused class BCodeCreator is eliminated
172
173
174///////////////////////////////////////////////////////////////////////////
175//Set-type related changes
176///////////////////////////////////////////////////////////////////////////
177btol\bdb\bdb.cpp
178btol\bdb\bdspool.cpp
179btol\bgrammar\graimp.cpp
180btol\bgrammar\spfuninst.cpp
181btol\bmodel\aia.cpp
182btol\bmodel\estim.cpp
183btol\bmodel\foread.cpp
184btol\bmodel\modcalc.cpp
185btol\bmodel\model.cpp
186btol\bmonte\mc-integrator.cpp
187btol\matrix_type\matgra.cpp
188btol\matrix_type\multimin.cpp
189btol\polynomial_type\polgra.cpp
190btol\real_type\datgrast.cpp
191btol\set_type\set.cpp
192btol\set_type\setgra.cpp
193btol\set_type\tol_bset.h
194btol\text_type\txtgra.cpp
195lang\language.cpp :
196-At BSet class BList* element_ is eliminated. When a list is needed a copy is available through ToList()
197-Access to BSet BTmpObject<Any>::Args() must be replaced by BList* ArgList() or DupArgList()
198-New class BGraContensFNDSet<BSet, Name_, Description_> inherited from BGraContensFND<Any,Name_,Description_> to allow special constructors of bulit-in functions returned sets
199-BSet constructor from BList* and operator= to BList* are eliminated to replace in this case by PutElement or RobElement
200
201
202///////////////////////////////////////////////////////////////////////////
203//Real-type related changes
204///////////////////////////////////////////////////////////////////////////
205btol/real_type/datgra.cpp
206bbasic/out.cpp :
207-New controls about number of errors and warnings exported to TOL user
208
209
210///////////////////////////////////////////////////////////////////////////
211//Complex-type related changes
212///////////////////////////////////////////////////////////////////////////
213btol/complex_type/cmpgra.cpp :
214-BCmpConstant* i_  is changed to BParamCmp
215
216
217///////////////////////////////////////////////////////////////////////////
218//Serie-type related changes
219///////////////////////////////////////////////////////////////////////////
220btol/serie_type/tol_btmser.h
221btol/serie_type/tsrgra.cpp :
222-dating_ nRefs_ is not touched by BTimeSerie because is non needed feature.
223-unused hashDat_ member has been eliminated
224
225btol\bdb\bdb.cpp
226btol\bdb\bdspool.cpp
227btol\bmodel\modprev.cpp
228btol\serie_type\srg.cpp
229btol\serie_type\tsr.cpp:
230btol\serie_type\tsrgra.cpp:
231btol\serie_type\tsrgrav.cpp:
232btol\serie_type\tol_btmser.h:
233btol\serie_type\tol_btsrgrp.h
234btol\set_type\setgra.cpp:
235-BData data_ is now really protected eliminating GetDataBuffer() access
236-New BTimeSerie member functions PutBufDat to change a dat, or Realloc, Alloc and Delete to manage memory
237bmath/mathobjects/tol_bdat.h
238bmath/mathobjects/dat.cpp:
239-New BData class inherited from BArray<BDat> to control Time Series used volume
240
241
242btol\bdb\bdspool.cpp
243btol\bmodel\estim.cpp
244btol\bmodel\modcalc.cpp
245btol\bmodel\tol_bmodel.h
246btol\matrix_type\matgra.cpp
247btol\real_type\datgra.cpp
248btol\real_type\datgsrst.cpp
249btol\serie_type\srg.cpp
250btol\serie_type\tol_btsrgrp.h
251btol\serie_type\tsrgrai.cpp
252btol\text_type\txtgra.cpp
253lang\language.cpp
254-BSerieGroup and BSerieTable use now a BArray<BUserTimeSerie*> instead of a BSet to store Series in order to avoid secondary effects of references over them
255-Now the only one creator for BSerieGroup and BSerieTable has no arguments.
256-Then you can add a Serie, a BList*, a BSet or another BSerieGroup or BSerieTable
257-After you can use BSerieGroup to prepare operations between series or test dating and date bounds of a collection of series
258 or you can filla BSerieTable with data from collected series.
259
260btol/bmodel/foread.cpp
261btol/bmodel/modcalc.cpp
262btol/bmodel/model.cpp
263btol/bmodel/tol_bmodel.h
264-BList* outLst_ and inLst_ are eliminated from BModel to apply new BSerieTable advantages
265
266
267///////////////////////////////////////////////////////////////////////////
268//Console related changes
269///////////////////////////////////////////////////////////////////////////
270lang/language.cpp :
271-revisited commands and user help for interactive console mode of tol.exe
272
273
274
275sizeof(BAtom)=8
276sizeof(BSyntaxObject)=16
277sizeof(BText)=12
278sizeof(BGraContens < BText >)=28
279sizeof(BGraConstant< BText >)=28
280sizeof(BRenContens < BText >)=20
281sizeof(BCopyContens < BText >)=32
282sizeof(BTmpContens < BText >)=40
283sizeof(BDat)=16
284sizeof(BGraContens < BDat >)=32
285sizeof(BGraConstant< BDat >)=32
286sizeof(BRenContens < BDat >)=20
287sizeof(BCopyContens < BDat >)=40
288sizeof(BTmpContens < BDat >)=48
289sizeof(BDate)=32
290sizeof(BGraContens < BDate >)=48
291sizeof(BGraConstant< BDate >)=48
292sizeof(BRenContens < BDate >)=20
293sizeof(BCopyContens < BDate >)=56
294sizeof(BTmpContens < BDate >)=64
295sizeof(BCode)=4
296sizeof(BGraContens < BCode >)=20
297sizeof(BGraConstant< BCode >)=20
298sizeof(BRenContens < BCode >)=20
299sizeof(BCopyContens < BCode >)=24
300sizeof(BTmpContens < BCode >)=32
301sizeof(BSet)=20
302sizeof(BGraContens < BSet >)=36
303sizeof(BGraConstant< BSet >)=36
304sizeof(BRenContens < BSet >)=20
305sizeof(BCopyContens < BSet >)=40
306sizeof(BTmpContens < BSet >)=48
307sizeof(BMatrix<BDat>)=44
308sizeof(BGraContens < BMatrix<BDat> >)=60
309sizeof(BGraConstant< BMatrix<BDat> >)=60
310sizeof(BRenContens < BMatrix<BDat> >)=20
311sizeof(BCopyContens < BMatrix<BDat> >)=64
312sizeof(BTmpContens < BMatrix<BDat> >)=72
313sizeof(BComplex)=72
314sizeof(BGraContens < BComplex >)=88
315sizeof(BGraConstant< BComplex >)=88
316sizeof(BRenContens < BComplex >)=20
317sizeof(BCopyContens < BComplex >)=96
318sizeof(BTmpContens < BComplex >)=104
319sizeof(BPolyn < BDat >)=12
320sizeof(BGraContens < BPolyn < BDat > >)=28
321sizeof(BGraConstant< BPolyn < BDat > >)=28
322sizeof(BRenContens < BPolyn < BDat > >)=20
323sizeof(BCopyContens < BPolyn < BDat > >)=32
324sizeof(BTmpContens < BPolyn < BDat > >)=40
325sizeof(BRational < BDat >)=24
326sizeof(BGraContens < BRational < BDat > >)=40
327sizeof(BGraConstant< BRational < BDat > >)=40
328sizeof(BRenContens < BRational < BDat > >)=20
329sizeof(BCopyContens < BRational < BDat > >)=44
330sizeof(BTmpContens < BRational < BDat > >)=52
331
332
333===================================================================
334===================================================================
335===================================================================
336Revisite
337
338
339
340bgrammar/txthash.cpp :
341          if((Mode() == BUSERFUNMODE) && (so.Mode() == BUSERFUNMODE))
342
343         
344===================================================================
345RCS file: /home/cvsroot/tolp/tol/bbasic/tol_batom.h,v
346retrieving revision 1.1.1.1
347diff -r1.1.1.1 tol_batom.h
34844c44
349<     BInt nRefs_; //!< Number of atom references
350---
351>     unsigned short nRefs_; //!< Number of atom references
35257c57
353
354
355===================================================================
356RCS file: /home/cvsroot/tolp/tol/bbasic/tol_butil.h,v
357retrieving revision 1.1.1.1
358diff -r1.1.1.1 tol_butil.h
359153a154,222
360>
361> //----------------------------------------------------------------------------
362>   class TOL_API BUInt24
363> //----------------------------------------------------------------------------
364
365
366===================================================================
367RCS file: /home/cvsroot/tolp/tol/bbasic/txtalgeb.cpp,v
368retrieving revision 1.6
369diff -r1.6 txtalgeb.cpp
3701363c1363,1364
371<     buffer_ = new BChar[size_ = maxChars+1];
372---
373>     size_ = maxChars+1;
374>     buffer_ = new BChar[maxChars+1];
3751378c1379,1380
376<       BChar *newBuf = new BChar[size_=(1+length_*2)];
377---
378>       size_=(1+length_*2);
379>       BChar *newBuf = new BChar[size_];
380
381
382Index: btol/bgrammar/gra.cpp
383===================================================================
384RCS file: /home/cvsroot/tolp/tol/btol/bgrammar/gra.cpp,v
385retrieving revision 1.6
386diff -r1.6 gra.cpp
38759a60
388>              bool          autoContens,
38976a78
390>       autoContens_(autoContens),
39185c87
392
393
394
395===================================================================
396Fallo del interfaz en proyectos
397[root]
398Children=1 2 3 4
399Description=Root node
400Exclude=0
401ExcludeTOL=0
402FileName=estimamg.prj
403Label=estimamg.prj
404Type=ROOT
405[1]
406Children=
407Description=Parámetros de la estimación
408Exclude=0
409ExcludeTOL=1
410FileName=paramicmg.tol
411Label=paramicmg.tol
412Type=TOL
413[2]
414Children=
415Description=Inicializa los parametros de la estimación, abre la conexión con la BBDD e incluye las funciones
416Exclude=0
417ExcludeTOL=1
418FileName=initestimationmg.tol
419Label=initestimationmg.tol
420Type=TOL
421[3]
422Children=
423Description=
424Exclude=0
425ExcludeTOL=0
426FileName=estimationmg.tol
427Label=estimationmg.tol
428Type=TOL
429[4]
430Children=
431Description=Cierra la conexión con la BDD
432Exclude=0
433ExcludeTOL=1
434FileName=../_end.tol
435Label=../_end.tol
436Type=TOL
437[Included TOL Files]
438Set estimamg.1=Include("paramicmg.tol");
439Set estimamg.2=Include("initestimationmg.tol");
440Set estimamg.3=Include("estimationmg.tol");
441Set estimamg.4=Include("../_end.tol");
442
443
444
445        : BCTmsTemporary()
446        {
447    PutName(name);
448    PutDescription(description);
449    Grammar()->AddObject(this);     
450
451
452   
453  {
454    if(HasName()) {Grammar()->DelObject(this);}
455  }
456   
457 
458 
459 
460Name: NObject
461Value: 21670
462
463Name: NCore
464Value: 798573
465
466
467
468Name: NObject
469Value: 13930
470
471Name: NCore
472Value: 389026
473
Note: See TracBrowser for help on using the repository browser.