Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Eclipse viewer architecture is slower than MVC??

"fast" means at first make more errors faster, "appropriate" means make
appropriate things with less failures - and to have an appropriate
design. imho are 80% of  performance appropriate design & architecture.
appropriate. there is no winner, except eclipse vis-a-vis netbeans, i
know both netbeans from the beginning in a czech company - the
perspective, view, editor approach of eclipse is far ahead the arch and
design winner.

try to fly a f-18 in your bedroom - it's very fast
what is a nano second for an momentum scientist, what are one billion
years for an Paleonthologist?

bax
ps: regarding your company: "if you can't change your job, change your
job"

----- Original Message -----
From: "Dinesh Varadharajan" <DVARADHARAJAN@xxxxxxxxxxxxx>
To: <eclipse-dev@xxxxxxxxxxx>
Sent: Wednesday, August 07, 2002 5:36 AM
Subject: [eclipse-dev] Eclipse viewer architecture is slower than MVC??


> Hi,
> In our company we are evaluating netbeans and eclipse for future
> development. We wrote a simple program on each of this program and in
> eclipse it is taking more time than in netbeans.
>
> The netbeans is using MVC architecture and eclipse's adapter
> architecture(Viewers ) are slower than MVC.
>
> The program consists of a tree and a 100x100 table. The tree has
alphabets
> as items. Whenever the user clicks the alphabet all the table cells
will be
> filled up with that alphabet. We implemented MVC in Netbeans and
viewers in
> Eclipse. In netbeans it is taking 10milliseconds and eclipse is taking
> 3seconds.
>
> Can any one fine tune this program to work fast as in netbeans.
>
> The program is
>
> import org.eclipse.jface.viewers.ILabelProviderListener;
> import org.eclipse.jface.viewers.IStructuredContentProvider;
> import org.eclipse.jface.viewers.ITableLabelProvider;
> import org.eclipse.jface.viewers.TableViewer;
> import org.eclipse.jface.viewers.Viewer;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.events.SelectionListener;
> import org.eclipse.swt.graphics.Image;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Table;
> import org.eclipse.swt.widgets.TableColumn;
> import org.eclipse.swt.widgets.Tree;
> import org.eclipse.swt.widgets.TreeItem;
>
>
> public class viewer {
> TableViewer tv = null;
> Tree tree = null;
> class Dummy{
> String[] values;
> public Dummy(){
> values = new String[100];
> }
>
> public String get(int i){
> return values[i];
> }
> public void set(int i, String value){
> values[i] = value;
> }
> }
> class ContentProvider implements IStructuredContentProvider{
> public void dispose() {}
> public void inputChanged(Viewer viewer, Object oldInput, Object
newInput){
> }
>
> public Object[] getElements(Object inputElement){
> Dummy dummy = (Dummy)inputElement;
> return dummy.values;
> }
> }
>
> class LabelProvider implements ITableLabelProvider{
> public Image getColumnImage(Object element, int columnIndex) {
> return null;
> }
> public String getColumnText(Object element, int columnIndex){
> Dummy dummy = (Dummy)element;
> return dummy.get(columnIndex);
> }
> public void addListener(ILabelProviderListener listener) {}
> public void dispose() {}
> public boolean isLabelProperty(Object element, String property){return
> true; }
> public void removeListener(ILabelProviderListener listener){}
> }
> public void run(){
> Display display = new Display();
> Shell shell = new Shell(display);
> shell.setLayout(new FillLayout());
> tree = new Tree (shell, SWT.BORDER);
> TreeItem root = new TreeItem (tree, 0);
> root.setText("root");
> for (int i= 65; i< 91; i++) {
> TreeItem treeitem = new TreeItem (root, SWT.NONE);
> byte[] data = new byte[1];
> data[0] = (byte)i;
> treeitem.setText(new String(data));
> }
> Table t1 = new Table(shell, SWT.NONE);
> t1.setHeaderVisible(true);
> t1.setLinesVisible(true);
> for (int i = 0; i < 100; i++) {
> TableColumn tableColumn = new TableColumn(t1, SWT.NULL);
> tableColumn.setWidth(20);
> tableColumn.setText("column "+i);
> }
> tv = new TableViewer(t1);
> tv.setContentProvider(new ContentProvider());
> tv.setLabelProvider(new LabelProvider());
> for (int row = 0; row<100; row++){
> Dummy foo = new Dummy();
> for (int col=0; col<100; col++)
> foo.set(col, "");
> tv.add(foo);
> }
> tree.addSelectionListener(new TreeSelectionListener());
> shell.open();
> while (! shell.isDisposed()) {
> if (! display.readAndDispatch()) display.sleep();
> }
> }
> Class TreeSelectionListener implements SelectionListener{
> public void widgetSelected(SelectionEvent e){
> for (int row = 0; row<100; row++){
> Dummy dummy = (Dummy) tv.getElementAt(row);
> for (int col=0; col<100; col++)
> dummy.set(col, tree.getSelection()[0].getText());
> tv.refresh(dummy);
> }
> }
> public void widgetDefaultSelected(SelectionEvent e){}
> }
> public static void main(String[] args) {
> new viewer().run();
> }
> }
>
>
> Thanks,
> Dinesh
>
>



Back to the top