Rugby Optimizations Update

Now I've had a little time to do some testing and built a set of test cases for server and client. These will be uploaded soon, because I want to test for some more bugs in Rugby.

It turns out that when the server reads 4096 bytes at a time from the buffer, it still hangs after 8680 bytes and then every 16 bytes above that. Therefore I lowered the read size to 2048 bytes which seems to work (purely by guessing unfortunately).

It's nearly as fast, but more importantly, it seems to be stable so far up to sending 50000 bytes from the client to the server.

A bug that causes a hang and 100% cpu on the server when sending exactly 3810 bytes to the server has been fixed.

Remember that the old sources are still available at the original location in the downloads section. The patched version is still available here.
|

Rugby Optimizations

I found that sending a fairly large amount of data from a client to the server takes an enormous amount of time while eating 100% CPU time. After a bit of digging, it turns out that Rugby reads data from the client port 16 bytes at a time, once the data has been transferred into the buffer from the client.
This gives horrendous performance on even small files at 10-50 kb in size, taking several seconds for Rugby to finish reading from the port. Furthermore, a function to detect EOD was performing a FIND on the incoming data on each 16 byte read. As this data grows, the FIND operation slows down a lot.

I patched the source to rugby.r to reduce the size of how much data is fed to the FIND function to 50 bytes of data. Then I also use adaptive resizing of how much data is read from the port, starting out at 4096 bytes from after reading Content-Length: (apparently the maximum allowed size) and then scaling down to 16 bytes when nearing the end.

A small test which took 14 seconds to complete on about 170 kb of data on the original rugby.r, now clocks in at 0.2 to 0.3 seconds!

But there is a small catch: The 16 byte alignment seems to be necessary to read, when getting near the end of data in the buffer. If this alignment isn't there, EOD isn't detected and Rugby hangs. I can presently not be 100% sure that the 16 byte alignment is reached every time with the adaptive resizing, so please test the code well.
|

Rebollious Blogging

I like reading The REBOL Week, because it's a good source of information on what's going on in the REBOL community in general.

BUT, then I read the following under a mention of my TOOLBAR announcement:

By The way, congrats to Henrik for his nice adaptation of the popular REBOL Blog engine which he sure turned into a slick looking page!

I wish that was true, but it's too early to say that. This blog is (still) run with RapidWeaver on a Mac. It's a nice program which is very easy to use and set up a page with, so I can recommend it for beginners. However, RapidWeaver is rather limited in the integration of its pages with REBOL pages. That's why you see primitive links to REBOL style Makedoc2 documents in the Downloads section. Quite disjointed, but it works somewhat for now.

Sometime in the future, I hope I will have time to carry on a new project, which I have temporarily left in November. It's a REBOL based site generator, combining various existing REBOL web page generating tools to a powerful way of describing web pages, using a site map dialect. Early tests show that it's ridiculously fast at generating about 10 pages in 2-3 seconds and you can generate entire websites in 10-20 lines of code. Sometimes REBOL just catches me by surprise at how fast you can do parsing.

What it can do right now:

  • Set up a website using a sitemap dialect. Everything related to site structure is kept in one little file.

  • Generator grabs data for the website from anywhere REBOL can read from (other sites, disks, etc.).

  • Grab plain text documents from various directories, catalog them by directory, process them with a modified Makedoc2 and integrate them into the website, completely skinned and with page navigation. (I think this is currently the most impressive feature Happy)

  • Placeholder pages.

  • Full two-level page navigation with an automatically generated horizontal menu.

  • Banner/presentation pages for projects.

  • Uniform, tasteful, lightweight and clean skin for all pages.

  • Can be served with any webserver.

  • Skinned directory/file lists.

  • Easily editable skins.


These are all static pages, and it works beautifully, but I'm not happy with the functionality of the code generator, as I like to have tools to be as easy to pipeline as possible and flexible enough to fit in most development pipelines. This one isn't just yet.

Then I started work on dynamic pages, but I stumbled upon some difficulties integrating Carl's Blogger script, because it's tuned for CGI, where I use a different approach with webserv.r. I then left the project temporarily to pursue another one.

If someone is making small REBOL scripts to generate web page contents (BSD License only, please), I'd like to know, because, the goal of this project is to create an easy to use complete package for creating rich websites with REBOL. Another goal is to present this as a commercial quality project, so features, reliability and flexibility will be important.

This is how it looks:

Pasted Graphic 4
Title Page

Pasted Graphic 5
Makedoc 2 document

Pasted Graphic 6
Automatically generated Makedoc 2 article list.


That's all I'll be saying about it for now. Happy

|

Image panning VID face

A while ago, I made a small face which puts an image inside an face and allows you to pan it around with the mouse or the cursor keys if it's too big. I've just uploaded it to the Downloads section.

Clipboard01

Here are some simple instructions:

1. Download the source.
2. do %pan-image.r in a console.
3. PAN-IMAGE is now available as a style for layout and you can write something like:

view layout [
pan-image http://www.rebol.net/photos/carl-france-cahors.jpg
]

Now move the image by dragging it with the mouse. The face takes arguments the same way as an ordinary image face.

Enjoy!
|

Words in VID

Ever wondered how to make your own VID style and how to make those dialect words work for your own style?

Anton Rolls has written a very nice and straight forward document regarding this.

Be sure to bookmark it.
|

Whoa, what's BUTTON-BAR?

TOOLBAR can also be used to create an easy horizontal button bar at the bottom of your window. This is not a new feature, but it has not been considered tested until a few months ago (where I probably should have mentioned it Happy). If you are using Tester, you'll see it in a few places in the sub windows, such as in the Test List Window.

I created a separate style called BUTTON-BAR for this. The dialect largely works the same, but the access to creating the buttons is a little easier, and there are 5 predefined buttons with predefined actions in the DATA-STORE block that work similarly to what you see in ALERT and REQUEST.

In your layout, you'd create the button bar like this:

view layout [button-bar with [data: [ok-btn cancel-btn]]]


And presto:

Pasted Graphic 2


Just like TOOLBAR, the button bar will stretch itself according to the width of your window or wherever you need it, but by default, it grows to the size of what the buttons require.

BUTTON-BAR is still not mentioned in the docs, but you can study the details of BUTTON-BAR in the source code at the bottom, along with the OK-BAR and OK-CANCEL-BAR styles. Those bars are standard bars for even easier button layouts.

Enjoy!

|

Toolbar Issues

Having used Toolbar for a long time in my programs, I find it to be very useful, so I thought I'd use a blog post to highlight it a bit again.

Pasted Graphic


However there is also a single issue that causes Rebol/View 1.3.2 to crash and I've backtracked it to be a part of some FEEL code that uses DETECT to detect when the icon should be highlighted according to mouse position. Along with this, you need to have an INFORM window open. REBOL/View crashes when you close the INFORM window. All of this has been reduced a while ago into RAMBO entry #4137.

It's rare, but the more complex your layout it, the more often it happens.

So what about changing the TOOLBAR code to get rid of the problem? I haven't yet found a solution; TOOLBAR mimics the toolbars used in MacOSX rather closely, including mouse over behaviour and the current solution using DETECT, is the only one, I've been able to find.

If you want to help, I can post a more technical note on how the FEEL code works. Leave your comments below. Happy

|

Toolbar update

I've uploaded a new version 0.0.9 of TOOLBAR. This one has a feature that will grow the toolbar size if you set the width of the toolbar initially to 0 -1. So now you can make TOOLBAR decide the size of your window, rather than only the other way around.

The default for TOOLBAR is still 100x50, but BUTTON-BAR is now set to 0x50 -1x50, so it will grow in size as it should.

You can find TOOLBAR in the Downloads section.
|