An open API service indexing awesome lists of open source software.

https://github.com/msink/kotlin-blink

Kotlin/Native blink sample
https://github.com/msink/kotlin-blink

Last synced: 3 months ago
JSON representation

Kotlin/Native blink sample

Awesome Lists containing this project

README

        

_Kotlin/Native_ code size measurement
=====================================

## C

```c
#include
#include

#define BLINK_LED 0

int main(int argc, char *argv[])
{
gpio_request(BLINK_LED, "blink-led");
gpio_direction_output(BLINK_LED, 1);
for (;;) {
mdelay(200);
gpio_set_value(BLINK_LED, 0);
mdelay(200);
gpio_set_value(BLINK_LED, 1);
}
}
```

compiled code size: (0x401609 - 0x4015B0) = 89 bytes

## Kotlin

```kotlin
import lib.*

const val BLINK_LED = 0

fun main(args: Array) {
gpio_request(BLINK_LED, "blink-led");
gpio_direction_output(BLINK_LED, 1);
while (true) {
mdelay(200);
gpio_set_value(BLINK_LED, 0);
mdelay(200);
gpio_set_value(BLINK_LED, 1);
}
}
```
compiled code size: (0x4351D9 - 0x434E60) + (0x401693 - 0x401620) = 1004 bytes

## Result

Kotlin code is (1004 / 89) = 11.3 times bigger.

Order of magnitude.