Optimizing Software Code using AI

Often in the release notes for our MIDAS room scheduling software, you may see the entry “Code Optimization”.

What is “Code Optimization”?

Code optimization is the process of refining our software’s source code to make it execute more efficiently, consume fewer resources, or improve its overall performance. It involves strategically modifying source code whilst at the same time ensuring the new code still produces the correct results.

Key goals of source code optimization:

  • Enhanced speed: Executing tasks more quickly
  • Reduced resource consumption: Using less memory, CPU cycles, or power
  • Improved scalability: Handling larger workloads effectively
  • Maintainability: Making code easier to understand and modify

Some common source code optimization techniques involve:

  • Algorithm optimization: Choosing more efficient algorithms
  • Loop optimization: Reducing loop iterations or overhead
  • Memory optimization: Minimizing memory usage and allocations
  • Input/output optimization: Streamlining data reading and writing
  • Caching: Storing frequently used data for faster access
  • Compiler optimization: Leveraging compiler features for automatic optimization
  • Profiling: Identifying performance bottlenecks to focus optimization efforts

Code Optimization in MIDAS

Over the years we’ve been developing MIDAS, all our code optimization work has been done manually.

This work has involved attempting to simplify and rewrite parts of the source code to be more efficient.

Code Optimizing with AI

In our latest release, MIDAS v4.35, for the very first time, a small section of source code has been optimized with the assistance of AI (or Artificial Intelligence).

We performed this AI code optimization as an experiment to see whether AI could potentially be used to aid our development processes in the future.

We chose a small “subroutine” from our software and asked an AI if it could optimize it for us.

A “subroutine” is essentially a small block of code which can be re-used and “called” repeatedly during a program’s execution.

The subroutine within the MIDAS software code that we asked an AI if it could optimize for us was basically a function which converts dates to “epoch” time.

Epoch time is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

How did the AI do?

Our original subroutine was 15 lines of code long. Using AI to optimize code, reduced this subroutine down to just 9 lines of code.

However, the initial source code that the AI generated for us did not just work “out of the box”. In fact, it didn’t work at all!

But using this AI generated code as a “template”, our team was able to modify the generated code so that it worked and produced the correct results.

Our team then extensively tested the new subroutine to ensure that it consistently produced the same expected output as the original subroutine.

Once we had a working subroutine that we were confident in, the next step was to “benchmark” the new routine against the old one. After all, there would be no point in using the new routine if there were no performance gains to be had, or indeed if the new code performed worse than the original.

To test this, we ran each subroutine 10,000,000 (10 million times), and analyzed the results:

Our Original Subroutine:
30 wallclock secs (30.28 usr + 0.00 sys = 30.28 CPU) @ 330229.18/s (n=10000000)

AI Optimized Subroutine:
27 wallclock secs (27.09 usr + 0.00 sys = 27.09 CPU) @ 369085.41/s (n=10000000)

To explain the above results, over 10 million iterations of each subroutine, the new AI optimized subroutine was more efficient. It ran (executed) quicker, and consumed less processing (CPU) power to achieve the same results as the original subroutine.

On our test server, the optimized subroutine was able to run 369,085 times in the space of one second, compared with 330,229 times in the space of a second for the original subroutine.

Ok, so the original subroutine was pretty quick and efficient to begin with – but with the assistance of AI, we were able to improve its efficiency by almost 12%.

Where do we go from here?

Firstly, don’t worry, Artificial Intelligence is not about to take over the development of our MIDAS software!

MIDAS has been – and will remain – coded, developed, and maintained by human programmers.

But our experiment – on a very small part of our code – has demonstrated that AI tools may be able to assist our human developers to write ever more efficient source code.

The result of such carefully applied optimizations is that our software can potentially run faster, use resources more efficiently, and provide a better overall user experience.


MIDAS v4.35 introduces support for generating “Quotations” for prospective bookings.

Generate quotations when making tentative bookings
Generate quotations when making tentative bookings

Used in conjunction with the “Tentative Bookings” feature, you can generate quotations for clients when making tentative bookings for them.

Should the client accept and pay the quotation online, their “tentative” booking(s) automatically convert to regular “confirmed” bookings.

A number of configurable options are available with the new Quotations feature, including:

Automatically Update Booking Type

When a quotation is accepted and paid online, MIDAS can automatically update the corresponding booking’s “type” to be any confirmed booking type you’ve already defined.

Choose whether bookings become confirmed if their quotations are partially or fully paid

You can control when a “tentative” booking automatically converts to a “confirmed” booking based on how its associated quotation is paid.

Automatically change a booking's type when a quotation payments are received
Automatically change a booking’s type when a quotation payments are received

MIDAS can either “confirm” a tentative booking on just a partially paid quotation, or only confirm the booking once its quotation has been paid in full.

New Quotation Template

Templates” in MIDAS allow an administrator to customize a range emails, invoices, and more.

There’s already separate templates available for regular, deposit, and cancellation invoices, as well as receipts and credit notes.

v4.35 adds a further template now for your Quotations.

New customizable Quotation template
New customizable Quotation template

The default quotation template is very similar to the default regular invoice template, but introduces some new “placeholder” template variables too.

An example of a new placeholder variable available for the quotation template is “%QUOTEEXPIRES%”.

This special variable is substituted (at time the quotation is printed or emailed) with the date and time that the quotation expires.

By default, a quotation expires when its corresponding tentative booking(s) would expire in MIDAS.

However, there’s a further option available….

Variable quotation terms

As mentioned above, quotations by default are only valid up until the expiration time of their corresponding tentative booking(s).

So as an example, let’s say a tentative booking is made to commence at 9am on a Monday. The tentative booking settings are set to expire the booking if it’s not confirmed at least 2 hours before it is due to commence.

If the tentative booking hasn’t been confirmed by 7am on the Monday, the booking will automatically expire and be removed from the system.

In essence, a quotation generated for the above booking would remain valid until 7am on the day of the booking.

After this time, the quotation (and tentative booking) will have expired.

Now one of the new quotation options allows MIDAS to convert a tentative booking to a confirmed booking is only a partial payment has been made against the quotation.

In such instances, we’ve included an option to allow you to update the quotation’s terms to be the same as your standard invoice terms (i.e. for example 30 days).

Change a quotation's terms upon partial payment
Change a quotation’s terms upon partial payment

This means that as long as a client pays something towards the quotation, they will then have longer to pay the remaining balance, just as if they were paying a regular invoice.


In a previous article, we talked about the various default input fields included in MIDAS as standard. One of the standard client input fields is for their “Facsimile” number (more commonly know as their Fax number).

We’ve included Fax as a “standard” client field since we first started MIDAS over 17 years ago. But our previous article got us thinking…. are fax machines still a thing in 2024?

We’ll admit, here at MIDAS HQ, we can’t remember the last time we received a fax. In fact, we can’t recall ever having sent one either!

What is a Fax Machine?

Now, it occurs to us that some reading this article may never have come across a fax machine! (Yes, we’re showing our age!)

So, if you’re not familiar, a fax machine – short for “facsimile machine” – is a technology used for transmitting documents over a traditional telecommunication (phone) network. It allows the near-instantaneous reproduction of text and images (all be it at low resolution) at a distant location.

A Fax Machine
A Fax Machine

The History Of The Fax Machine

Early Conceptualization (19th Century):
The concept of transmitting images over long distances actually dates back to the 19th century. In 1843, Scottish inventor Alexander Bain received a patent for his idea of a “Copying Telegraph” that could transmit images using a series of synchronized pendulums.

Pantelegraph (1865):
In 1865, Italian inventor Giovanni Caselli developed the “Pantelegraph,” which was the first practical fax machine. It used a rotating stylus to scan and transmit handwritten messages and images over telegraph lines.

Facsimile Transmission (1920s):
During the 1920s, advancements in radio technology led to the development of early versions of fax machines that utilized radio waves for transmission. These machines were primarily used for newspaper photo transmission.

Telephotography (1930s):
In the 1930s, “telephotography” systems emerged, allowing photographs to be sent over telephone networks. However, these systems were expensive and not widely adopted.

Xerox LDX (1964):
The first commercialized fax machine was the Xerox LDX (Long Distance Xerography), introduced in 1964. It used the then-common electrostatic printing technology to transmit documents over long distances.

ITU Standardization (1980s):
In the 1980s, the International Telecommunication Union (ITU) developed standardized protocols for fax transmission, which facilitated interoperability between different fax machines and networks.

Thermal Transfer Fax Machines (1980s-1990s):
In the 1980s and 1990s, thermal transfer fax machines gained popularity due to their lower cost and improved printing quality.

Internet Faxing (1990s):
With the rise of the internet, fax technology evolved to include internet faxing or “fax over IP,” which enabled faxes to be sent and received through email and online fax services.

Decline and Legacy (2000s-2010s):
As digital technologies like email and document scanning became more prevalent, the use of traditional fax machines declined. However, fax technology continues to be used in some industries, especially in areas where secure document transmission is essential.

Modern Fax Services (Present Day):
Today, faxing has largely transitioned to digital platforms and online fax services. These services use internet protocols to send and receive faxes electronically, eliminating the need for physical fax machines and allowing for more efficient and secure document transmission.

Though the traditional standalone fax machine’s popularity has waned, the concept of faxing lives on in digital form, offering a reliable means of transmitting documents in various professional settings.

Do people still use fax machines?

The number of people using fax machines has declined due to the increasing adoption of digital communication methods like email, cloud-based document sharing, and secure messaging platforms. As a result, faxing has become less common in many regions, especially in developed countries.

While some specific industries and regions might still rely on fax machines for certain purposes, it’s safe to say that the number of people using traditional fax machines globally has significantly decreased. Online fax services and digital communication in general provides a more efficient and convenient way to send and receive documents these days. The traditional fax machine has become far less relevant.

You Got A Fax

Getting The Facts on Fax!

As MIDAS includes a field to enter a Fax number for each client record, we were keen to understand how – and indeed if – our customers use this field.

In August 2023, we took an anonymized random sample of 190 of our cloud hosted customer’s MIDAS systems. Between them, this sample of MIDAS systems contained a total of 213,887 individual client records. Here’s what we discovered…

90% of MIDAS systems have the “Fax” field enabled

We were quite surprised that this was figure so high! However, it should be noted that the Fax field is actually enabled by default in all fresh installations of MIDAS. Therefore, only 10% of customers have taken action and disabled this field.

Of the 90% of MIDAS systems where the “Fax” field is enabled, not a single system has been configured to mark this as a “Required” field.

Only 0.44% of clients have a fax number

We found that only 0.44% of client records within our anonymized sample of cloud-hosted MIDAS systems we host, contained an entry in the “fax” field. It’s also possible that some customers actually use the “Fax” field to record other client data – like an additional cell/mobile number. Therefore, it’s reasonable to assume that less than 0.44% of clients have an actual fax number.

Facing The Facts on Fax!

So what are our key takeaways from these facts? How can we use this information moving forward?

Despite 90% of MIDAS systems having the Fax field enabled, this field is utilized by less than half a percent of clients.

It’s fair to say that the “Fax” client field isn’t really used! For all intents and purposes, it’s obsolete.

Our first takeaway from this is that the “Fax” field probably shouldn’t be enabled by default. By initially “hiding” this field, it will simplify the editing of client records.

We’re taken this one step further for MIDAS v4.35. In this software update, we’ve actually removed “Fax” as a standard MIDAS client field all together. Instead, if customers do wish to capture client fax numbers, they could easily create a custom client field for this purpose instead.

Existing customers still using the previous standard “Fax” client field need not worry! We’ve ensured that the software update process to v4.35 automatically migrates your client fax data over to a custom client field with the same name.


MIDAS ships with a set of standard booking and client input fields. These input fields allow you to capture specific details about a client and their bookings.

Standard Input Fields In MIDAS
Standard Input Fields In MIDAS

Now some of these fields will always be required. For bookings, a minimum of a date and a venue (room/bookable space) is required. All other booking fields can be set to be optional. Likewise, for clients, a minimum of the client’s name is required. All other client fields can be set to be optional.

Here’s a list of the standard fields which are included in MIDAS by default:

Default Booking FieldsDefault Client Fields
DateClient
Times (Booking)Organization
Times (Setup / Breakdown)E-mail Address
VenueMailing Address
Client / OrganizationTelephone Number
AttendeesFax Number
Booking TypeCell/Mobile Number
Booking NotesClient Notes
Resources

MIDAS also allows you to “turn off” fields that you don’t need. So if you don’t need to capture a client’s fax number, you can disable that field.

But that’s not all – in addition to the standard “default” fields, you can create additional custom booking or client fields in MIDAS.

Adding Custom Fields

A range of different types of custom fields can be created, including:

  • Checkbox – A “tick box” field.
  • File – Allows uploading/attaching of files and documents to bookings or client records (self-hosted systems only)
  • List (Single Select) – A drop-down list of pre-defined items from which a single item may be selected.
  • List (Multi Select) – A drop-down list of pre-defined items from which multiple items may be selected.
  • Number – A field that will only accept numerical input.
  • Range – A “slider” control allowing selection of a numeric value within a defined range.
  • Text – A single-line text field.
  • Text Area – A multi-line text field.
  • URL – A navigable web link to an external resource.

As with standard fields, custom fields can also be set to be “required”. This means that an input is required in the custom field each time it’s shown.

New Validation Feature

For MIDAS v4.34, we’re extending the capabilities of marking custom number, text, text area, and URL fields “required”.

Let’s take the example of a custom single-line text field. Marking this as a required field would ensure that a user would enter something into the field. However, MIDAS wouldn’t check what they’d actually entered. Just entering a single character, or gibberish would be enough to allow you to proceed.

From v4.34 onwards, when setting a custom number, text, text area, and URL field as “required”, you can instruct MIDAS what values are considered “valid” for the field. A user would then need to enter a “valid” value in order to proceed.

Custom Field Validation Using Regular Expressions
Custom Field Validation Using Regular Expressions

A Simple Example

As an example, you could make it so that a user has to enter the word “YES” into a custom text field in order to proceed. If the custom field doesn’t contain the word “YES”, the user will be prompted to correct their entry:

Require Valid Entries In Custom Fields
Require Valid Entries In Custom Fields

The Power Of REGEX

Regular Expressions (REGEX) can be used to create more complex validations for your custom fields too. We’ll cover REGEX in more depth in a future article. In the meantime, as a brief introduction, here are a few simple yet useful REGEX’s for validating entries into your custom fields:

DescriptionREGEX
Value must start with the letters “BOOK”^BOOK
Value must end with the letters “ING”ING$
Value must contain “BOOKING”BOOKING
Value must be exactly “BOOKING”^BOOKING$
Value must contain a number (digit)\d
Value must not contain a number (digit)\D
Value must be exactly “BOOK”, followed by two single digit numbers^BOOK\d\d$

You’ll find further examples together with detailed explanations in our KB article: How to use Regular Expressions for custom input validation.

How To Use

Custom field validation can be setup via MIDAS Admin Options → Manage MIDAS → Fields.

On any custom number, text, text area, or URL fields, right-click (or long press on touch screens) on the field’s “Required” box.

You’ll then be able to set or modify the Regular Expression that should be used to validate entries to the field.