473,804 Members | 3,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Optimized table with fixed size cells?

Hi all,

I am trying to write a terminal emulator using Javascript + AJAX and I
need to create an 80x25 table (each cell
contains 1 character) in which I can update the contents of each cell
very efficiently.

The tests I have done up to now seem to indicate that each time I
update the cell contents (using innerHTML), the entire table is
resized and redrawn. This makes my app very slow.

Is there a way (CSS maybe) that I can indicate to the table that the
cells are of fixed size and that any update of cell contents only
requires a redraw of that particular cell?

Thanks a lot,

Patrick LeBoutillier

Feb 4 '07 #1
3 4338
On 2007-02-04, patl <pa************ ******@gmail.co mwrote:
Hi all,

I am trying to write a terminal emulator using Javascript + AJAX and I
need to create an 80x25 table (each cell
contains 1 character)
There's a first time for everything!
in which I can update the contents of each cell very efficiently.

The tests I have done up to now seem to indicate that each time I
update the cell contents (using innerHTML), the entire table is
resized and redrawn. This makes my app very slow.

Is there a way (CSS maybe) that I can indicate to the table that the
cells are of fixed size and that any update of cell contents only
requires a redraw of that particular cell?
How particular implementations optimize reflow is not accessible. You
could try using innerText or replaceChild instead of innerHTML, but it
might well not make any difference.

Instead of using a table you could just make each character a <span>,
each line a <divand use a monospace font (if you want columns all the
same width). Then the browser is more likely to reflow only one line at
at a time. I suppose 25 tables with one row each for each line might
also work.
Feb 4 '07 #2
"patl" <pa************ ******@gmail.co mwrites:
Hi all,

I am trying to write a terminal emulator using Javascript + AJAX and I
need to create an 80x25 table (each cell
contains 1 character) in which I can update the contents of each cell
very efficiently.

The tests I have done up to now seem to indicate that each time I
update the cell contents (using innerHTML), the entire table is
resized and redrawn. This makes my app very slow.

Is there a way (CSS maybe) that I can indicate to the table that the
cells are of fixed size and that any update of cell contents only
requires a redraw of that particular cell?
How about 25 divs or 80 spans (untested):
<div class="row">
<span id="r00c00"></span><span id="r00c01"></span>...
</div>
<div class="row">
<span id="r01c00"></span><span id="r01c01"></span>...
</div>
....

your CSS can set

div.row span {
width: 1em;
}

and if you still get re-flow, why not add IDs to the row divs
(id="r00", id="r01"...) and position everything absolute (using ems of
course) or maybe just absolutely positioned rows:

div.row { position: absolute; left: 0; }
#r00 { top: 0em; }
#r01 { top: 1.2em; }
#r02 { top: 2.4em; }
....
--
Ben.
Feb 5 '07 #3
Scripsit patl:
The tests I have done up to now seem to indicate that each time I
update the cell contents (using innerHTML), the entire table is
resized and redrawn. This makes my app very slow.
This isn't really an HTML question, and other answers in this thread might
point to better directions, but...
Is there a way (CSS maybe) that I can indicate to the table that the
cells are of fixed size and that any update of cell contents only
requires a redraw of that particular cell?
Yes, in CSS you can set table-layout: fixed for a table, and a browser will
then use the widths calculated for cells in the the first row as column
widths, no matter what the contents of other cells might require. The
primary reason is to speed up rendering. (When a table is very large, it
takes time for a browser to read all rows and analyze the width requirements
of all cells before deciding on the column widths.) It _might_, however,
affect the rendering in your case, too.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6827
by: Danny | last post by:
Hello I am trying to keep a table or row a fixed size. I have a javascript that assigns different images to the SRC of the main image, but the table will resize whne there is a smaller height image in there sometimes. I tried setting the height, but it seems to ignore it. What to do?
11
6785
by: Linny | last post by:
Hi, I need some help in declaring an array of pointers to array of a certain fixed size. I want the pointers to point to arrays of fixed size only (should not work for variable sized arrays of the same type). eg: int arr1;//Array of 20 ints int arr2; int arr3; ............
3
1893
by: gscott66 | last post by:
Hello, I am fairly new to design and in particular CSS. I have a site with two tables that I cannot seem to get sized correctly. When you view the link, you'll notice that there is a tremendous amount of space inbetween the cells, which is making the page entirely too long and/or wide. Can I style these tables in a way that makes the text more compact. Any other advice regarding the tables would be appreciated as well. Thanks in...
0
1525
by: Ken Varn | last post by:
I have a managed C++ assembly in which I need to interact with some 'C' APIs that take fixed size 'C' data blocks. I need to wrap these data blocks into a managed object. It seems like a lot of redundancy and extra code to have to marshal .net data from managed to unmanaged for this. Is there some built-in method in managed C++ that can allow me to create a managed structure and convert it into a fixed size 'C' data block? I am trying...
5
4177
by: collection60 | last post by:
Hi people, I am writing a library that will implement a binary file format. Well... I'm thinking, as a design, it would be nice to have my library able to promise to not use more than a certain amount of RAM. I could have a "SetCacheSize(long NewSize);" function. So as part of that promise, when required memory exceeds that limit, the extra data is saved to disk and flushed from RAM.
8
3726
by: chrisben | last post by:
Hi, If I am not sure how many items will be in my Hashtable/ArrayList dynamically (multiple threads can add/remove/check the item), however, I can estimate the total number will not exceed 60000. How much can I gain in term of performance if I decalre the hash as Hashtable h = new Hashtable(60000); instead of
2
4062
by: neuneudr | last post by:
Hi everybody, I'm scratching my head with a CSS problem. I want to have the following (the two pics have these size for a good reason, the whole point of the page is basically to show these pices at these fixed sizes) : spacer - fixed size picture - spacer - fixed size picture - spacer
3
3857
by: jerrygadd | last post by:
Hi can anyone please help? I have a need to make a table of fixed size, containing three rows, where the middle row auto expands to fill the remaining space between the top and bottom rows. Here is what I have so far, unfortunately using height:100% for the middle row blows the size of the table! <html> <head> <title>Auto expanding middle row!</title>
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.