From Sprezz Towers

Notes from the workshop.

Technical discoveries, field notes, unlikely bugs and the occasional opinion.

BFSs Redux - being an examination of the concept of Base Filing Systems

Those of you with long memories may well remember the heyday of Advanced Revelation when it seemed that every week somebody would come out with a new BFS – or “Bond” as we then called it. Starting with Icicle Software and their Lotus 123 bond followed by AS400 bonds, dBase bonds, SQL Server Bonds, Universe Bonds – the list grew and grew. These days though we seem not to hear quite so much about them so we thought that with the forthcoming re-introduction of the SQL Bond in 9.2 it might be time to revisit this subject. So what is a BFS? The clue is – as ever – in the title. Base Filing System. A Base Filing System is the lowest level of file system available in a Revelation environment. Ultimately it is an abstraction of all of the operations required to manipulate a particular file format encapsulated into one conceptual black box program. We say “conceptual” because there is nothing stopping a BFS being made up of more than one program – a classic example of this is the Linear Has...

Read article → 2 comments

UTF8 - The BRemove statement

Recent changes to the "[]" operators in OpenInsight 9.2 have resulted in substantial performance improvements to UTF8 mode string handling. This post highlights another such enhancement introduced in 9.2 to help bring UTF8 mode applications up to the standard of their ANSI counterparts. Consider the Loop/Remove construct below: 0001   /* 0002      Example showing standard loop/remove construct used 0003      to parse dynamic arrays at high speed 0004   */ 0005   0006      mark  =   1 0007      pos   =   1   ;   * // This is the CHARACTER position 0008       Loop 0009          Remove  nextVal  From  dynArray  At  pos  Setting  mark 0010 ...

Read article → 2 comments

Indexing in OpenInsight Part 3 - How transactions get updated

So now we’ve covered how the index transactions get put into the bang table all that is left is to discuss how they move from the bang table as transactions into the bang table as balanced index nodes. In the first article we explained that transactions were introduced to allow slow hardware to distribute the transaction processing. In addition to this the engineers at Cosmos had to come up with a way of allowing individual workstations to use spare processing power (when the PC was left unused) to move the transactions from the bang file into the index itself in a way that was easily interruptible if the user wanted to take control of their PC again. This being the case they opted not to move transactions straight from the bang file into the indexes as this could be an intensive operation. Before pressing on with an explanation of this let’s briefly review what the transactions actually contain.  At this stage we’re not going to explain the precise structure of the index trans...

Read article →

UTF8 and the extended string operators

As was pointed out in a recent post the performance of the "[]" string operators in UTF8 mode is pretty poor. In fact it's downright painful - If you've not seen the effects before go and create yourself a UTF8 application and then try compiling a program. The speed drop you see is due to the system pre-compiler (REV_COMPILER_EXPAND) making heavy use of the "[]" operators during the compilation process in a manner similar to this: 0001   /* 0002      This is the usual way of implementing fast string parsing in Basic+. 0003      We scan along the string looking for a delimiter, and remember 0004      where we found it via the Col2() function. For the next iteration 0005      we increment that position...

Read article → 4 comments

UTF8 - To Malloc or not to Malloc - that is another question

In our recent post on using memory pre-allocation when building large strings commenter M@ pointed out quite correctly that using the normal [] operators while in UTF8 mode results in a severe performance hit due to the necessity of calculating the character position of the insertion point during each iteration. A workaround that was suggested was to temporarily switch to ANSI mode for the [] operation and then switch back afterwards. This is a valid solution and one we've used ourselves before, but it does create a possible failure point: If your system hits a fatal debug condition before you switch back you might unknowingly be stuck in ANSI mode which could result in subsequent data corruption. A safer alternative to this is to use the PutBinaryValue function that we documented here - this ignores any string-encoding and does a straightforward binary copy to the specified offset. Here's the Preallocation sample program from the previous post updated with the binary functio...

Read article →

To Malloc or not to Malloc - that is the question

As part of one of our conference presentations we're showing log file analysis in OpenInsight. If you've ever tried any of this you'll know that the files can get pretty big pretty quickly and trawling through them extracting substrings and building new arrays can be a time consuming process. For one particular application we had to build a field mark delimited array from the data we were retrieving from file and - conscious of the penalty incurred by using operators - we were merrily using := String : @Fm syntax. Despite this attempt at efficiency the operation was still woefully slow - not so much as put the kettle on slow as cook gourmet dinner from scratch, eat and wash up slow. So we had to find a way to speed up the operation. Fortunately as we've posted on the Revelation forum before there is an easy way to do this - preallocating memory. Let's compare the rival techniques and see how we get on. The Operator Subroutine  ZZ_SpeedTest (  Void  )   ...

Read article → 4 comments

EditTable Cookbook - Handling Large Arrays

Way back in the days of OpenInsight 7.2.1 the EditTable was modified so that the speed of setting large amounts of data via the LIST or ARRAY properties was significantly increased. What was not changed was the speed of getting data via LIST or ARRAY and this can have a impact on the setting speed if you're not careful, because each Set_Property operation performs an implicit Get_Property regardless of whether or not you actually want the original data. For example, if you already have 10000 lines of data in your EditTable and you want to use the LIST or ARRAY property to set new data you may still see a speed drop as the system uses the slow Get_Property to retrieve the original data before the update. To overcome this problem you can tell the EditTable to clear the existing data before you use Set_Property, that way the implicit Get_Property has nothing to process. This can be done with SendMessage() and the DTM_RESETDATA message like so: 0001       equ ...

Read article →

UTF8 and Binary Manipulation

One of the most important points to bear in mind when using the Basic+ string handling functions is that all normal string operations are character-based - not byte-based. This has major implications if you wish to manipulate your data in a byte-oriented fashion when in UTF8 mode, because UTF8 is a multi-byte encoding scheme; i.e. it doesn't always follow that one byte represents one character as is the case in ANSI mode. To overcome this issue Revelation introduced several new Basic+ functions way back in OpenInsight 7.0 that explicitly allows binary manipulation regardless of the string-handling mode you are currently in (Note that these functions are intrinsic to the Basic+ language and do not need to be declared before use). These functions are: GetByteSize GetBinaryValue PutBinaryValue CreateBinaryData The intention of this blog post is to document these functions and to make you aware of them so that you can develop your applications correctly should you wish to work in UTF8 ...

Read article →

EditTable Cookbook - Trapping Mouse Messages

Getting notification of mouse messages has always been something of a problem with OpenInsight EditTable controls. With other controls this process is quite easy - you simply qualify the WINMSG event with the relevent mouse message number and you can easily respond to it, but with an EditTable this process fails. This is mainly due to the architecture of the EditTable itself - it's not really a single control, it's actually two: The visible control that you interact with (known as the "DataTbl" control) and a very thin parent wrapper around it (called the "Editable" control). When you use an EditTable control in your application OpenInsight creates the wrapper control which in turn creates the visible "DataTbl" control. When you interact with an EditTable in Basic+ you are interacting directly with the wrapper - it simply passes on your request to the "DataTbl" as appropriate. If you qualify the WINMSG event on an EditTable you are quali...

Read article →