Google Summer of Code 2020 with GNU Octave

Hello there. In this blog post, I will describe my work with GNU Octave during Google summer of code 2020. I will also add links to the commits I have made and repositories I have worked on. Let’s get started.

About my project

JavaScript Object Notation, in short JSON, is a very common human readable and structured data format. My project aims to provide GNU Octave with a builtin support for that data format.

Specifically, My project provides GNU Octave with two functions:

  • jsondecode: This function decodes JSON-formatted strings into Octave objects.
  • jsonencode: This function encodes Octave objects into JSON-formatted strings.

Having JSON support, Octave can improve for example its web service functions, which often exchange JSON data these days.

My contribution to GNU Octave during GSoC

For the past few months, I’ve been working with my mentors on my project. This work resulted in the following commits that were pushed into the main repository of Octave:

  • 5da49e37a6c9: This commit contains nearly all of my work during GSoC. It adds the functions jsonencode and jsondecode to GNU Octave.
  • aae9d7f098bd: This commit improves the integration of the functions into Octave’s build system.
  • 34696240591e: This commit improves the documentation of the functions.
  • 0da2fbd3a642: This commit improves the documentation of the functions.
  • 174550af014f: This commit adds more tests and improves the documentation of the functions.

Those commits contain:

  • The code of the two functions.
  • Unit tests.
  • Documentation (Doxygen documentation for the developers and Texinfo documentation for the users).
  • Code to add the new functions to the build system.

I was working on this stand-alone repository then at the final stages of GSoC, The code was moved to my fork of the Octave mirror on GitHub.

How to use my project

As I said before, my project is already pushed to the main repository of Octave. To use it, all you have to do is to build the default branch of Octave. This article shows how to do this.

What to do after GSoC

A benchmark was implemented by my mentor to assess the performance of the functions. The benchmark results showed that jsondecode has some performance issues. After some investigations, we were able to pinpoint what slows the performance which is makeValidName function. This function is written in Octave scripting language which is much slower than C++. So, I am going to rewrite the core of this function in C++ and make the m-file of makeValidName call it. This will definitely improve the performance of jsondecode.

Finally, I would like to say that I really had a wonderful experience during Google Summer of Code 2020 with GNU Octave and I am looking forward to contribute more in the future. Also, I would like to thank:

  • The team of the Google Summer of Code program for supporting such an amazing experience.
  • The community of GNU Octave for helping me during this wonderful journey.
  • My co-mentors and my mentor for providing me with continuous support and help that facilitated my work a lot. It has been my pleasure to get to know you.
Written on August 28, 2020