How heavy is "Document"?

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Kelly Leahy - Software Architect, Milliman
Version: 4.0.0250
Avatar
My application is essentially a collection of formulae that I store in separate "variable" definitions. When I load my data file from disk, I am considering parsing all of the formula definitions so that I have the benefits that the AST and token-stream representations have to offer for a rich UI experience (dependency analysis, etc.).

As I see it, there are a couple of ways I could do this - one way would be to modify my lexical analyzer and parser to support calling by my code as well as the syntax editor (I've actually already done this, but it would have to be done again if I want to support non-mergable language). Another way would be to simply keep a "document" object (syntax editor's Document) for each of my formulae in memory and attach it to my object model. That way, when a user needs to edit a formula in the syntax editor, I can just attach the editor to that document instance and there I go (currently I'm setting the document.text on the syntax editor to the formula text each time the user changes formulas to edit).

My question is this: do you feel that keeping a document instance for each variable definition would be too heavy?

Here's some stats about my data (not likely to change much, maybe increase by 100% for user files):

Vars Loaded: 2461
Average text length: 272

Let me know if you need more info to answer this question, hopefully you can give me some advice on this, as I'm just not sure how much overhead creating that many Document objects would entail.

Thanks,

[Modified at 06/05/2007 10:04 AM]

Kelly Leahy Software Architect Milliman, USA

Comments (1)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Well since you do have almost 2500 vars, that may be a little stressful on memory. What if you do something like our DocumentOutline sample where you just parse them all into ASTs and then make your own resolver class that stores those ASTs? That way you don't retain any Documents or Tokens but you do have all the ASTs available.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.