Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28742

Re: alternatives to eval() for this case

From Martin Honnen <mahotrash@yahoo.de>
Newsgroups comp.lang.javascript
Subject Re: alternatives to eval() for this case
Date 2015-09-27 10:30 +0200
Organization Liberty Development
Message-ID <mu89el$78e$1@news.albasani.net> (permalink)
References <1a8362bb-6ff2-41a9-93b2-5469b67ffd02@googlegroups.com> <1b5a10d5-b323-4b6a-a9e2-e49979dfe502@googlegroups.com>

Show all headers | View raw


Jay Braun wrote:

> We are investigating the use of a browser to replace a legacy GUI for a legacy simulation model.  The model can conceivably store about 100K objects at any given time.  It might begin a scenario with a few thousand objects, then have tens of thousands added to the scenario all at once.
>
> Each object's graphical representation typically consists of at least 4 different SVG elements:  a basic shape like a square or circle, one or more additional lines, dots, etc., to distinguish the object's role more specifically, a line indicating speed and course, and an ID.  I chose SVG over Canvas because of its scalability and because of some capabilities provided by the DOM.
>
> I generate JavaScript scripts periodically with a C program on the server side that accesses a database updated by the simulation.  The C program doesn't break a sweat writing the JavaScript.  I am *not* dumping the whole database every time, but at certain junctures, many objects might be added to the scenario all at the same time.
>
> If anyone here thinks I'm barking up the wrong tree (or down the wrong DOM), I welcome your comments at this early stage.


Do you generate Javascript code that then creates SVG elements? As an 
alternative approach you could try to have the server-side code generate 
the SVG snippets and load them with XMLHttpRequest and insert them into 
the DOM tree. Loading XML (and SVG is XML) is what XMLHttpRequest was 
originally designed for.

I can't tell whether that performs better than creating Javascript 
script code that generates SVG elements but it sounds like a cleaner 
approach.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

alternatives to eval() for this case Jay Braun <lyngwyst@gmail.com> - 2015-09-25 10:26 -0700
  Re: alternatives to eval() for this case Danny <dann90038@gmail.com> - 2015-09-25 15:39 -0700
    Re: alternatives to eval() for this case Jay Braun <lyngwyst@gmail.com> - 2015-09-25 15:50 -0700
  Re: alternatives to eval() for this case Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-09-26 00:35 -0300
    Re: alternatives to eval() for this case Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-09-26 09:33 +0200
  Re: alternatives to eval() for this case Jay Braun <lyngwyst@gmail.com> - 2015-09-26 20:14 -0700
    Re: alternatives to eval() for this case Martin Honnen <mahotrash@yahoo.de> - 2015-09-27 10:30 +0200
      Re: alternatives to eval() for this case Jay Braun <lyngwyst@gmail.com> - 2015-09-27 07:45 -0700

csiph-web