The Mac series with the Apple Silicon M1 chip has been released. Weren’t you surprised by the amazing performance of it? I was also. I hoped we can use the wonderful power and Apple’s ecosystem for Elixir programming, so I tried to write Elixir code to call Swift code. This article shows how to call Swift code from Elixir via NIF.

Here is the repository of such a sample code:

Nov 24, 2020: I updated "Makefile" in the repository in order to be able to build it in case of initialized Mac, so the bellow figures includes some wrong points…

This story shows important history of software engineering between 1990s and 2000s, which includes the background of the birth of Agile software development, Software product line engineering (SPLE) and eXtreme derivative development process (XDDP).

Importance of estimation of efforts of software development

Most of the actual cost of software development is personnel expenses because it is a human-intensive work. They are roughly proportional to the product of the numbers of the people and months spent on development. A unit called man-month is derived from an assumption of this proportional relationships. Usually, a software developer charges its customer development costs based on estimated or actual man-months. It is an…

Verification and Validation

Software testing is an activity as part of verification and validation or software verification and validation.

Read the definitions of verification and validation from the article “Verification and validation” of Wikipedia.

In other words, verification is to check whether or not software or system meets to its requirements, while validation is to check whether or not requirements of software or system meets to its purposes of users and/or customers.

On the other hand, read the definition of software verification and validation from the article "Software verification and validation" of Wikipedia.

Boehm defines:

Verification: Are we building the product right? …

Before structured programming

If a program has no structure and is chaotic as the below figure shows, the following quality characteristics will be getting worse:

  • Maintainability (Analyzability; Changeability; Stability; Testability)
  • Portability

This is called commonly, “a status like spaghetti”.

A sample flowchart of an unstructured program

Structured Programming

Such a program can be replaced into a nested program (the below figure shows), according to Structured program theorem.

I’ll give typical examples for each type of construction languages, which is explained at Chapter 3 of SWEBOK Evolution:

Configuration languages

One of typical examples of configuration languages is setting files of Windows and Unix operating systems.

For example, /etc/X11/xorg.conf is a setting file for X server, which provides graphic functions using graphic boards. A sample code fragment is here:

Section “ServerLayout”
Identifier “Default Layout”
Screen 0 “Screen0” 0 0
InputDevice “Mouse0” “CorePointer”
InputDevice “Keyboard0” “CoreKeyboard”

ToolKit Languages

One of typical examples of toolkit languages is Template Toolkit of Perl. It is used by a web server written in…

You may feel software engineering is difficult and confuses you. If so, it is due to differences between it and other sciences.

Reason 1: Software is an artifact, that is, an object made by persons. It may be often so large that the creators of it can't understand the whole of it any longer. Thus, only one technology can't solve all problems of software engineering, that is, No Silver Bullet. Though some one may say, "this technology will solve all problems of software engineering", software engineers will know that fact that it is false in almost all case. …

Traditional and typical kinds of a human resource are a generalist and a specialist. A generalist has literacy, knowledge and skills for all fields. On the other hands, a specialist has a specified knowledge and skills to one field, which also is called I-typed human resource (I型人材) in Japan.

In Japan, a person that is well versed in all fields is called a T-, π- and H-typed human resource (in Japanese, T型人材,π型人材 and H型人材, respectively). A T-typed human resource is a person who has literacy for all fields and specified knowledge and skills to one field. A π-typed human resource…

I've just released Pelemay 0.0.6:

A new feature of this release is to support String.replace.

defmodule M do
require Pelemay
import Pelemay

defpelemay do
def string_replace(subject) do
String.replace(&1, "Fizz", "Buzz")

def enum_map_string_replace(list) do
|> String.replace(&1, "Fizz", "Buzz"))

This code is 4x faster than original Elixir code.

## StringReplaceBench
benchmark name iterations average time
Pelemay String.replace 1000000 1.20 µs/op
Enum String.replace 500000 3.92 µs/op
Flow String.replace 5000 678.27 µs/op

The reason that Flow is much slower is that Flow in Benchfella requires Enum.sort.

I implemented it with #pragma to generate SIMD instructions:

int string_replace_binary(ErlNifBinary…

Thank ElixirConf for giving me another chance to make a presentation at ElixirConf US 2019:

This presentation will be conducted by me and Mr. Hisae, who is a graduate student in my laboratory and a co-author of Hastega. He's a great meta-programmer because he wrote a new feature of Hastega only one night! Look forward to an announcement on it at ElixirConf US 2019!

BTW, development of Hastega has been smooth but a little late. …

Do you want to learn and use machine learning in Elixir / Phoenix / Nerves apps? Of course, you can, but the machine learning is written in Python and invoked from Elixir via ErlPort... Of course, you can implement some machine learning algorithms in Elixir. However, they have no computational power enough to execute real applications. We wish Elixir could have more computational power!

This may change by Hastega! Hastega will make a series of code fragments of pipelined to be transformed into optimized native code using GPUs and/or CPUs with SIMD instructions.

What's GPUs and SIMD?

GPUs are main components of graphic…

Susumu Yamazaki

Call me ZACKY. I'm a researcher of Elixir. My works are including Pelemay, (its old name is Hastega) .

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store