The most important part is the definition of shapes. We ourselves built applications that rendered >10.000 elements and links (counting to more than 80.000 SVG DOM elements) very fast and with instant interaction. There are couple things that are not exactly optimal when rendering bigger graphs. First, the JointJS special attributes such as ref-x, ref-y, ... (
http://jointjs.com/api#SpecialAttributes). These are great for simple diagrams because they allow you to position SVG elements relatively to other SVG elements. However, this is not good for bigger graphs as JointJS has to first calculate the bounding box of the referenced elements in order to position the others. JointJS is pretty generic in lot of things which comes with a performance tradeoff. But if you stick to good techniques, you can achieve pretty good performance. Please see the example attached showing some of the techniques that we use. Here's an explanation:
1. joint.dia.FastPaper: this paper first renders into the document fragment asynchronously and dumps this fragment into the live DOM with each batch of cells added. Moreover, it disables the sortViews() method which normally sorts SVG elements in the live DOM according to the z-index set (the z property).
2. A good practice when creating new shapes is to always define a view and a model. The model only works with data while the view reacts on changes in this data and re-renders accordingly (see the initialize() method of the joint.shapes.basic.ConveyorElementView). Also, notice we completely skipped the 'markup' property containing SVG string in order to skip the repeated SVG parsing. We define the SVG DOM elements (innerRect/outerRect) and clone them in the overwritten renderMarkup() method. The rest of the code of the view just updates the SVG nodes when the associated model properties change. For this, we take advantage of the built-in Vectorizer SVG library (
http://jointjs.com/api#v) which is our lightweight mini-SVG library.
Good news is that if you use these techniques, everything else in JointJS/Rappid will work as well. In other words, these tweaks don't break any core or plugins functionality.
It is possible to optimize even further using some smart techniques. For example, on the first render, the user probably does not see the whole diagram anyway so one can render only some part of the diagram and render the rest later on once the user scrolls or after a certain delay so that the paper contains only those elements/links that are visible in the viewport.